I want to highlight particular para/list with their corresponding voice.
Is there any callback in responsivevoice.js. I got onend as callback function.But it is not working .
whenever I am putting console instead of highlight , it is producing only one instead of three.
I think onend is calling after only first para .But it should work for all para/ul
Please help me out..
My code:-
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="http://code.responsivevoice.org/develop/1.5.2/responsivevoice.js"></script>
<script>
var currentDataValue =0;
$( document ).ready(function(){
$("#1").click(function(){
$("p,ul").each(function( index, element){
responsiveVoice.speak($(this).text(),$('UK English Female').val(),{
pitch: .7,
onend: function() {
$(this).css( "backgroundColor", "yellow" );
}
});
});
});
});
$( document ).ready(function(){
$("#2").click(function(){
responsiveVoice.pause();
});
});
$( document ).ready(function(){
$("#3").click(function(){
responsiveVoice.resume();
});
});
$(window).load(function(){
$("#4").click(function(){
responsiveVoice.cancel();
});
});
</script>
</head>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<ul>
<li>this unoder list </li>
</ul>
<p id="test">This is another paragraph.</p>
<button id="1">start</button>
<button id="2">pause</button>
<button id="3">resume</button>
<button id="4">stop</button>
</body>
</html>