我在同一页面上有两个jQuery可滚动的实例。不幸的是,我认为有一些覆盖和碰撞正在发生。如何进行修改以使它们一起正常工作?
//Scrollable for Social Sidebar area
$(".socialScrollable").scrollable({ next:".socialNext", prev:".socialPrev", easing:"easeInOutCubic", vertical:true});
var scrollable = jQuery(".socialScrollable").data("scrollable");
var size = 3;
scrollable.onSeek(function(event, index) {
if (this.getIndex() >= this.getSize() - size) {
jQuery("a.socialNext").addClass("disabled");
}
});
scrollable.onBeforeSeek(function(event, index) {
if (this.getIndex() >= this.getSize() - size) {
if (index > this.getIndex()) {
return false;
}
}
});
第二集:
//Scrollables for Media page
$(".mediaScrollable").scrollable({ easing:"easeInOutCubic"}).navigator({navi:'#pressNavTabs'});
$("#mediaNavScrollable").scrollable({ easing:"easeInOutCubic", next:".nextMedia", prev:".prevMedia"});
var mediaScrollable = jQuery("#mediaNavScrollable").data("scrollable");
var mediaSize = 4;
scrollable.onSeek(function(event, index) {
if (this.getIndex() >= this.getSize() - mediaSize) {
jQuery("a.nextMedia").addClass("disabled");
}
});
scrollable.onBeforeSeek(function(event, index) {
if (this.getIndex() >= this.getSize() - mediaSize) {
if (index > this.getIndex()) {
return false;
}
}
});
答案 0 :(得分:0)
http://flowplayer.org/tools/demos/scrollable/site-navigation.html
他们有两个在同一页面上运行。也许你的变量范围存在问题?