javascript - Automatic click for <a> with class name -


i created audio playlist using <ul> , <li>, javascript code automatically plays next song when 1 song ends , working well.

but have tracks in slider, , want slider move along, song changes.

is there way can have javascript click button next slide well?

code next slide:

<a class="lsnext"></a> 

javascript:

$(window).load(function(){   var audio;   var playlist;   var tracks;   var current;    init();   function init(){     current = 0;     audio = $('audio');     playlist = $('#playlist');     tracks = playlist.find('li a');     len = tracks.length - 1;     audio[0].volume = 1;     audio[0].play();     playlist.find('a').click(function(e){       e.preventdefault();       link = $(this);       current = link.parent().index();       run(link, audio[0]);     });     audio[0].addeventlistener('ended',function(e){       current++;       if(current == len){         current = 0;         link = playlist.find('a')[0];       }else{         link = playlist.find('a')[current];           }       run($(link),audio[0]);     });   }   function run(link, player){     player.src = link.attr('href');     par = link.parent();     par.addclass('active').siblings().removeclass('active');     audio[0].load();     audio[0].play();   } });//]]>  

use

$('.lsnext').click(); 

after line ( inside function)

audio[0].addeventlistener('ended',function(e){ 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -