我上周在 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 (向下箭头消失,最后一个缩略图下方不允许有空白区域。
最佳答案
上面的解决方案看起来可行,但在这里也找到了解决方案:
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/