播放列表上一个/下一个
我用的是FLOWPLAYER 我有一个播放列表,但我不使用他们的播放列表插件。 我有 PREV/NEXT 按钮,因此我可以相互导航。
演示 :: 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);
//return false;
});
});
但它只能工作一次。 #next 和 #previous 的值保持相同的值。 它不会递增或递减。
我在下面找到了这个,但仍然不起作用。它会跳过视频...
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 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);
//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;
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定我完全理解你想要什么。我认为你在那里循环是有原因的。但是,我猜您想引用正在循环的当前链接实例,而不是
$("#clips a")
- 这不是迭代器。如果您只想对正在播放的元素执行此操作,请为其指定“playing”类,并且仅使用具有该类
$("#clips a.playing")
的链接。无需循环所有这些。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.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.只需选择
.playing
,而不是所有链接。Just select
.playing
, not all links.