I've got two instances of a jQuery scrollable on the same page. Unfortunately, I think there's some overwriting and collision going on. How do I modify to get them to both work together and properly?
//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;
}
}
});
Second set:
//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;
}
}
});
http://flowplayer.org/tools/demos/scrollable/site-navigation.html
They have two running on the same page here. Perhaps its a problem with your variable scoping?
精彩评论