javascript - jQuery 工具 - 垂直滚动条中的一项太长

标签 javascript jquery css

我上周在 jQuery Tools 官方论坛上问过这个问题,但它肯定不如 stackoverflow 活跃,所以我想我也会在这里问。

在我们的元素详细信息页面上,我们动态加载内容,其中使用垂直滚动条进行导航。问题是垂直滚动条的高度似乎总是有一项太高了。我找不到任何方法来以编程方式影响它。

如果我将它的 circular 设置为 true,它似乎具有正确的高度,但我们不希望它是连续的/圆形的。

这里的例子: http://www.centerline.net/projects/detail/?p=21

Unminified JS 在这里: http://www.centerline.net/lib/js/site-unmin.js

有什么想法吗?

这是滚动到最后一个元素时应该是什么样子的 View (向下箭头消失,最后一个缩略图下方不允许有空白区域。 Correct Vertical Scroller Stop Point

最佳答案

上面的解决方案看起来可行,但在这里也找到了解决方案:

http://www.jasoncarr.com/technology/jquery-tools-scrollable-stop-scrolling-past-the-end

我网站的实际代码是这样的:

$(function() {
  // Initialize the Scrollable control
  $(".scroll").scrollable({vertical:true, mousewheel:true, keyboard:true });

  // Get the Scrollable control
  var scrollable = jQuery(".scroll").data("scrollable");

  // Set to the number of visible items
  var size = 2;
  // Handle the Scrollable control's onSeek event
  scrollable.onSeek(function(event, index) {

    // Check to see if we're at the end
    if (this.getIndex() >= this.getSize() - size) {

      // Disable the Next link
      jQuery("a.next").addClass("disabled");
    }
  });

  // Handle the Scrollable control's onBeforeSeek event
  scrollable.onBeforeSeek(function(event, index) {

    // Check to see if we're at the end
    if (this.getIndex() >= this.getSize() - size) {

      // Check to see if we're trying to move forward
      if (index > this.getIndex()) {
        // Cancel navigation
        return false;
      }
    }
  });

});

关于javascript - jQuery 工具 - 垂直滚动条中的一项太长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5804713/

相关文章:

html - 第 n 个子代码不起作用

jQuery:使用固定标题平滑滚动

asp.net - 如果加载的页面具有 ASP.NET 身份验证 cookie,如何从 JavaScript 检查?

javascript - 当我删除 map 中的对象时出现问题。我需要调用该函数 3 次

javascript - 如何使用 window.caches 从 window 对象中保存页面?

javascript - JQuery函数只允许文本框中的字母不起作用

javascript - 悬停时随机更改音频源?

javascript - 当 div 元素隐藏时跳过 jQuery 验证

javascript - 如何将数据从 Python 脚本发送到 JavaScript,反之亦然?

html - 我可以仅通过使用纯 CSS 来改变 Ruby 中文本区域的美观吗?