在这里简单看一下widgetkit是一种可能的解决方案。使用jquery,您可以搜索任何具有一个幻灯片类的对象,并使用下一个子对象并单击其他所有对象。下面提供的代码未经测试,但应指向正确的方向。只要你不叫停止传播或防止默认,那么原来的点击处理程序仍然应该触发。
var slideshow_count = $('.slides .next').length;
var cascade_countdown = 0;
$('.slides .next').each(function() {
$(this).click(function() {
// stop an infinite loop if we're already cascading till we've done it for all the elements.
if(cascade_countdown != 0) {
cascade_countdown--;
return true;
}
// we don't include the slideshow we're clicking in this count
cascade_countdown = slideshow_count - 1;
var clicked_el = this;
$('.slides .next').each(function() {
// only click elements that aren't the initiator
if(this !== clicked_el) {
$(this).click();
}
});
});
});
看看是什么?我们可以看到你到目前为止? – 2012-03-23 02:05:38
请张贴一些相关的代码,并欢迎来到Stack Overflow。 – 2012-03-23 02:05:52
我想你忘了在我们可以看到代码的地方添加一个引用。请修改您的帖子。 – 2012-03-23 02:06:08