我在同一页面上有两个可滚动的 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;
}
}
});