【问题标题】:scrolltofixed limit issue and flickeringscrolltofixed 限制问题和闪烁
【发布时间】:2013-12-21 00:14:12
【问题描述】:

如果我在函数中使用 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;
    }
});

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

【问题讨论】:

    标签: jquery css function limit flicker


    【解决方案1】:

    创建一个标记元素,我称之为 .footer-marker,放置在 .footer 的正上方。然后,在页脚的限制函数中使用它。

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

    这是修改后的小提琴:

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

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

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

    希望对您有所帮助。

    【讨论】:

    • 我可以问你一些关于ScrollToFixed插件的事情吗?
    猜你喜欢
    • 1970-01-01
    • 2015-01-04
    • 2016-03-06
    • 2012-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多