粘性"_calc"不适用于此元素 [英] Sticky '_calc' is not an available method for this element
问题描述
在使用Foundation 6时,我尝试调用粘性标头的重新计算.但是,我尝试返回的所有内容都将返回
I'm trying to invoke the recalculation of the sticky header when using Foundation 6. However everything i attempt returns
很抱歉,'_ calc'不适用于该元素
We're sorry, '_calc' is not an available method for this element
这是粘滞元素的声明:
<div id="sticky-container" data-sticky-container>
<div id="sticky" data-sticky data-margin-top="0" data-top-anchor="the-table"
data-btm-anchor="footer:bottom" style="width: 100%">
我尝试过:
$('.sticky:visible').foundation('_calc', true);
$('#sticky-container').foundation('_calc', true);
$('#sticky').foundation('_calc', true);
所有这3种用法均返回_calc
不可用.
All 3 of these usages returns the _calc
is not available.
推荐答案
我认为问题在于,您不是在直接调用.foundation
和_calc
之前直接调用$(document).foundation();
.在测试中,如果在调用$(document).foundation();
之前调用$('#sticky').foundation('_calc', true);
,则能够复制错误.问题源于以下事实:调用$('#sticky').foundation('_calc', true);
I think the problem is that you're not calling $(document).foundation();
directly before the call to .foundation
with _calc
. In my tests, I've been able to replicate the error if I call $('#sticky').foundation('_calc', true);
before $(document).foundation();
is called. The issue stems from the fact that the sticky element hasn't been initialized when you're calling $('#sticky').foundation('_calc', true);
-
小提琴 ,其中以前称为
$(document).foundation();
.
小提琴 ,其中$(document).foundation();
被称为.
我很确定是上述原因.如果没有,请告诉我.
I'm pretty sure the above is the cause. If not, please let me know.
这篇关于粘性"_calc"不适用于此元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!