gpt4 book ai didi

jquery - scrolltofixed 限制问题和闪烁

转载 作者:行者123 更新时间:2023-11-28 18:00:37 27 4
gpt4 key购买 nike

如果我使用函数中的 scrolltofixed 插件调用页脚的限制,我会遇到一个奇怪的问题。

由于页脚和动态内容存在其他问题,我已经在限制下进行了此解决方法。

这里是 original fiddle :

$('.footer').scrollToFixed( {
bottom: 0,
limit: $('.footer').offset().top,
preFixed: function() {
$(this).find('h1').css('color', 'blue');
},
postFixed: function() {
$(this).find('h1').css('color', '');
}
});

这里是fiddle with my magical flickering footer :

$('.footer').scrollToFixed( {
bottom: 0,
limit: function() {
return $('.footer').offset().top - $('.summary').outerHeight() - 0;
}
});

谁能指出我在这里失踪了吗?

最佳答案

创建一个标记元素,我将其命名为 .footer-marker,放置在 .footer 的正上方。然后,在页脚的限制功能中使用它。

limit: function() { return $('.footer-marker').offset().top; }

这是修改后的 fiddle :

http://jsfiddle.net/ZczEt/1650/

我删除了摘要外部高度减法,因为它似乎没有做任何事情。

此外,由于我假设摘要具有动态内容,因此摘要现在返回一个函数来限制它。此处的限制作为函数将补偿加载到摘要中的动态内容。

希望对您有所帮助。

关于jquery - scrolltofixed 限制问题和闪烁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20516645/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com