I'm trying to invoke the recalculation of the sticky header when using Foundation 6. However everything i attempt returns
We're sorry, '_calc' is not an available method for this element
Here's the declaration of the sticky 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%">
I've tried:
$('.sticky:visible').foundation('_calc', true);
$('#sticky-container').foundation('_calc', true);
$('#sticky').foundation('_calc', true);
All 3 of these usages returns the _calc
is not available.
答案 0 :(得分:1)
我认为问题是您在使用$(document).foundation();
致电.foundation
之前未直接致电_calc
。在我的测试中,如果在调用$('#sticky').foundation('_calc', true);
之前调用$(document).foundation();
,我就能够复制错误。问题源于这样一个事实:当你打电话给$('#sticky').foundation('_calc', true);