在 Fancybox 中使用 iScroll

发布于 2024-12-26 14:40:55 字数 231 浏览 3 评论 0 原文

我正在尝试在 iScroll 4 “ rel="nofollow">Fancybox 但没有任何乐趣。

iScroll 附着在内容上,你可以用手指推动它使其滚动,但当你松开它时它会弹回来。它的行为与内容适合其容器时的行为一样。

I'm trying to use iScroll 4 within a Fancybox but with no joy.

iScroll attaches to the content, and you can push it with your finger to make it scroll, but when you let go it bounces back. It's behaving as it does when the content fits within its container.

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

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

发布评论

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

评论(1

梦罢 2025-01-02 14:40:55

解决方案是在 Fancybox 出现后立即对 iScroll 对象调用 refresh()

$("#about-button").fancybox({
    onComplete: function () {
       my_iscroll.refresh();
    }
});

使用 Fancybox 的推荐方法是将内容隐藏在

或类似的内容,但这会阻止浏览器对其执行任何布局,从而阻止 iScroll 知道它有多大。

The solution is to call refresh() on your iScroll object immediately after the Fancybox appears:

$("#about-button").fancybox({
    onComplete: function () {
       my_iscroll.refresh();
    }
});

The recommended way to use Fancybox is to hide your content in a <div style='display:none'> or similar, but that prevents the browser from performing any layout on it, and hence prevents iScroll from knowing how big it is.

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