开发者

Using Two Instances jQuery Tools Scrollable on a Single Page

开发者 https://www.devze.com 2023-04-01 21:04 出处:网络
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

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号