如何解除绑定jquery.scrollTo插件?

发布于 2024-12-04 20:14:45 字数 769 浏览 2 评论 0原文

我在此页面上使用 jquery rollto 插件: http://tinyurl.com/3l49ccu)

当我调整窗口大小时,滚动不再起作用,因为“偏移”设置发生了变化。我想在调整大小时重新定义此设置。

该插件的作者在本页的评论中解释了“如何解除绑定”: http://flesler.blogspot.com/2008/03/jqueryserialscroll-110-released.html

但我没能成功 工作。

我尝试过这个:

    $(window).bind("resize", function(){
    $('#sideshow').unbind('.serialScroll');
    }

谢谢


仍在调查...... 我在这里问过这个问题: http://forum.jquery.com/topic /如何重置serialscroll-settings-on-window-resize

I use the jquery scrollto plugin on this page : http://tinyurl.com/3l49ccu)

When i resize the window, the scroll is not working anymore because the "offset" setting changed. I would like to redefine this setting on resize.

The author of the plugin explain "how to unbind" in the comments of this page : http://flesler.blogspot.com/2008/03/jqueryserialscroll-110-released.html

but i couldn't make it work.

i tried this :

    $(window).bind("resize", function(){
    $('#sideshow').unbind('.serialScroll');
    }

thanks


still investigating…
i asked about this problem here :
http://forum.jquery.com/topic/how-to-reset-serialscroll-settings-on-window-resize

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

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

发布评论

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

评论(2

月亮邮递员 2024-12-11 20:14:45

这样做..删除 .

 $(window).bind("resize", function(){
    $('#sideshow').unbind('serialScroll');
   }

do in this way..remove .

 $(window).bind("resize", function(){
    $('#sideshow').unbind('serialScroll');
   }
耳根太软 2024-12-11 20:14:45

点是正确的,因为 unbind('.serialScroll') 删除所有名称间隔事件。尽管如此,我还是无法解决这个问题。我注意到的一件事是,行 $("#slideshow p").css("width", (parseInt(slideshowWidth)-2) + "px"); 导致p 调整大小时展开。

我注意到的另一件事是该插件使用#slideshow 的scrollLeft 属性来调整幻灯片的位置。我在浏览器中编辑时尝试了以下步骤但没有成功。也许您在编辑本地文件时运气更好:

  1. 使用 $('#sideshow').unbind('.serialScroll'); 取消绑定所有serialscroll事件,
  2. 就像在页面加载时
  3. 设置scrollLeft属性 一样初始化serialscroll在 #slideshow 上回到原来的位置

我的主要问题是幻灯片动画到第一张图片。设置scrollLeft属性是没有用的,因为它立即被动画覆盖。我无法弄清楚如何立即停止动画,所以我把这个留给你。

祝你好运

The dot is correct, because unbind('.serialScroll')removes all name spaced events. Still, I could not get around the problem. One thing I noticed is, that the line $("#slideshow p").css("width", (parseInt(slideshowWidth)-2) + "px");causes the width of the p expand on resize.

Another thing I noticed was that the plugin uses the scrollLeft property of the #slideshow to adjust the position of the slideshow. I tried the following steps but did not succeed, while editing in browser. Maybe you have more luck when editing your local files:

  1. unbind all serialscroll events with $('#sideshow').unbind('.serialScroll');
  2. initialize serialscroll like you do at pageload
  3. set the scrollLeft property on #slideshow back to where it was

My main problem was that the slideshow animated to the first picture. Setting the scrollLeft property was useless, because it was instantly overriden by the animation. I was not able to figure out how to stop the animation in no time, so I leave this to you.

Good luck

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