JQuery Scrollable 滚动得比实际想要的更远

发布于 12-18 07:52 字数 547 浏览 4 评论 0原文

我正在使用 JQuery Scrollables 来显示图片库,请参阅 http://www.mba-europe。 de/lehr_veroff.html

在我的设置中,我有一个包含 .bitems.bscrollable DIV DIV 包含所有 .item DIV,类似于 .scrollable.items< JQuery Scrollables 演示页面中的 /code> 和 .item

但是,正如您所看到的,滚动不会在到达列表中的最后一个元素后立即停止。相反,用户可以进一步滚动,直到只有最后一个元素可见,然后是(在我的例子中)三个空槽。

如何避免进一步滚动,以便始终可见不少于四个元素?

此致, 菲利普

I'm using JQuery Scrollables to display an image gallery, see http://www.mba-europe.de/lehr_veroff.html

In my setup, I have a .bscrollable DIV that contains a .bitems DIV that contains all the .item DIV's in analogy to .scrollable, .items and .item from the JQuery Scrollables demo page.

However, as you can see, scrolling doesn't stop as soon as the last element in the list is reached. Instead, the user can scroll further until only the last element is visible, followed by (in my case) three empty slots.

How do I avoid scrolling further, such that there are always no less than four elements visible?

Best regards,
Philip

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瀞厅☆埖开2024-12-25 07:52:10

您可以使用 scrollable 的 api 来实现,如下所示;

var $scrollables = $('.bscrollable').scrollable({
    size: 4,
    mousewheel: true,
    vertical: false,
    horizontal: true
}).data('scrollable');
$scrollables.onBeforeSeek(function(e, i) {
    var threshold = $scrollables.getSize() - 4;
    if(i > threshold) {
        e.preventDefault();
    }
});

工作示例

You can use scrollable's api to achive that like this;

var $scrollables = $('.bscrollable').scrollable({
    size: 4,
    mousewheel: true,
    vertical: false,
    horizontal: true
}).data('scrollable');
$scrollables.onBeforeSeek(function(e, i) {
    var threshold = $scrollables.getSize() - 4;
    if(i > threshold) {
        e.preventDefault();
    }
});

Working example

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文