1
我已经配置了大部分作品的词缀,如可以在此页面上可以看到:http://wisderm.com/ingredients/Green+Tea+Extract引导3词缀位置刷新
这是我的代码,用于动态改变词缀偏移:
// nav-pills is the class of the <ul> element of the sidebar
// #hero-unit is the jumbotron
// where to start scrolling from
$('.nav-pills').affix({
offset: { top: function() { return $('#hero-unit').outerHeight(true)+10; } }
});
// after changing from affix-top to affix
$('.nav-pills').on('affixed.bs.affix', function() {
$('.nav-pills').css("margin-top", function() { return -$('#hero-unit').outerHeight(true)+10; });
});
// after changing back to from affix to affix-top
$('.nav-pills').on('affixed-top.bs.affix', function() {
$('.nav-pills').css("margin-top", 0);
});
问题是,一旦我向下滚动到affix-top
已更改为affix
的位置,并且我刷新页面时,加载的词缀比页面下的要低得多。为什么会发生这种情况,我该如何解决?
真棒,工程。 –