粘性“_calc”不是此元素的可用方法
Sticky '_calc' is not an available method for this element
我试图在使用 Foundation 6 时调用粘性 header 的重新计算。但是我尝试的一切 returns
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 种用法 returns _calc
不可用。
我认为问题在于您没有在使用 _calc
调用 .foundation
之前直接调用 $(document).foundation();
。在我的测试中,如果我在调用 $(document).foundation();
之前调用 $('#sticky').foundation('_calc', true);
,我已经能够复制错误。问题源于这样一个事实,即当您调用 $('#sticky').foundation('_calc', true);
时粘性元素尚未初始化
我很确定以上就是原因。如果没有,请告诉我。
我试图在使用 Foundation 6 时调用粘性 header 的重新计算。但是我尝试的一切 returns
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 种用法 returns _calc
不可用。
我认为问题在于您没有在使用 _calc
调用 .foundation
之前直接调用 $(document).foundation();
。在我的测试中,如果我在调用 $(document).foundation();
之前调用 $('#sticky').foundation('_calc', true);
,我已经能够复制错误。问题源于这样一个事实,即当您调用 $('#sticky').foundation('_calc', true);
我很确定以上就是原因。如果没有,请告诉我。