javascript - How do I add a button to activate Annyang JS? -
sorry noob question js skills extremely limited. implementing annyang webpage. loads page, prefer add button activate it. here's have far:
<script> if (annyang) { // let's define command. var commands = { 'hello': function() { alert('hello, can speak navigate around website. try saying "contact"'); }, 'goodbye': function() { alert('goodbye!'); }, 'contact': function() { window.location.href='../contact-us/'; }, }; // add our commands annyang annyang.addcommands(commands); // start listening. annyang.start(); } </script> <button class="btn btn-secondary-alt view-more" onclick="annyang.start();">speak now</button>
thanks in advance help
just remove annyang.start()
in script. line calls when annyang ready.
Comments
Post a Comment