javascript - Change picture when audio is playing (jQuery, HTML5) -
i need this:
<script> $(window).load(function(){ function swapimages(){ var $active = $('#mygallery .active'); var $next = ($('#mygallery .active').next().length > 0) ? $('#mygallery .active').next() : $('#mygallery img:first'); $active.fadeout(function(){ $active.removeclass('active'); $next.fadein().addclass('active'); }); } $('#audio').click(function() { alert("yessssssssssss!"); setinterval("swapimages()", 5000); }); }); </script>
the "click function" doesn't work. have mention, audio part loaded php file after previous jquery call action. so, can do?
thanks!
<audio controls='controls' id='audio'> <source src=". $final_file ." type='audio/mp3'/> </audio>
if audio file loaded @ later stage using .on() , not .click()
$('body').on('click', '#audio', function() { alert("yessssssssssss!"); setinterval("swapimages()", 5000); });
Comments
Post a Comment