开发者

playlist prev/next

开发者 https://www.devze.com 2023-01-29 20:53 出处:网络
I use FLOWPLAYER I have a playlist but I don\'t use their playlist plugin. I have PREV/NEXT buttons, so I can navigate to one another.

I use FLOWPLAYER I have a playlist but I don't use their playlist plugin. I have PREV/NEXT buttons, so I can navigate to one another.

demo :: http://baazooka.com/_ext/flowplayer/index.html

    $("#clips a").each(function(index){

    $("#next").click(function(){
    var nex = $("#clips a").next().attr('href');
          $f().play(nex);
          return false;
   });
   $("#previous").click(function(){
    var pre = $("#clips a").prev().attr('href');
          $f().play(pre);
       开发者_如何学Python   //return false;
   });

});

but it only works one time. the value of #next and #previous keep the same value. it doesn't in crement or decrement.

i've found this below but still doesn't work. it skips videos...

   var link = $("#clips a");

link.each(function(i){ $("#next").click(function(){ var nex = link.eq(i+1).attr('href'); $f().play(nex); return false; }); $("#previous").click(function(){ var pre = link.eq(i-1).attr('href'); $f().play(pre); return false; });


I'm not sure I understand what you want completely. I assume you have the looping in there for a reason. But, I'm guessing you want to refer to the current link instance that you are looping over instead of the $("#clips a") - this isn't an iterator.

$("#clips a").each(function(index){
    var link = $(this);

    $("#next").click(function(){
    var nex = link.next().attr('href');
          $f().play(nex);
          return false;
   });

   $("#previous").click(function(){
    var pre = link.prev().attr('href');
          $f().play(pre);
          //return false;
   });
});

If you just want to do this on an element that is being played, give it a class 'playing' and only work with the link that has that class $("#clips a.playing"). No need to loop over all of them.


$("#clips a").each(function(index){
  $("#next").click(function(){
    var nex = $("#clips a.playing:first").next().attr('href');
    $f().play(nex);
    return false;
  });
  $("#previous").click(function(){
    var pre = $("#clips a.playing:first").prev().attr('href');
    $f().play(pre);
    return false;
  });
});

Just select .playing, not all links.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号