javascript - Turn on schuffle when click jQuery -


i trying make random play, click button, automatically after film opened next.

this code works when movie finish have manually click #schuffle , opens next item. want had click once , activated code every time when film completed, is, return 0.

$(document).ready(function() {   $("#schuffle").on('click',function(e) {                         //ytplayer.getplayerstate() return 0 when video finish             //if youtube video finish              if ( ytplayer.getplayerstate() == 0 ) {                 //click random element out .koncentrator a.utwor                 var list = $('.koncentrator a.utwor');                 //click random .koncentrator a.utwor                 list.eq(parseint(math.random()*list.length)).click();                 //scroll element                 $(".active").get(0).scrollintoview();       }   }); }); 

what this? if user clicks on button activates setinterval checkyoutubevideo() every second.

function checkyoutubevideo() {     //ytplayer.getplayerstate() return 0 when video finish     //if youtube video finish     if ( ytplayer.getplayerstate() == 0 ) {          //click random element out .koncentrator a.utwor         var list = $('.koncentrator a.utwor');          //click random .koncentrator a.utwor         list.eq(parseint(math.random()*list.length)).click();          //scroll element         $(".active").get(0).scrollintoview();     } }  $(document).ready(function() {     $("#schuffle").on('click',function(e) {         setinterval(checkyoutubevideo(), 1000);     }); }); 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -