将 Zurb Foundation 和 jQuery 与 Edge Animate 一起使用,我收到此错误:
Uncaught TypeError: Object [object Object] has no method 'foundation'
....仅在从事件处理程序中调用基础函数时。从事件处理程序外部,它工作正常。
<div id="myModal" class="reveal-modal">
<h2>Title</h2>
<p class="lead">Description</p>
<a class="close-reveal-modal">×</a>
</div>
<a href="#" id="myButton" class="button">Click Me</a>
<script>
$(document).foundation();
// This works as expected
$('#myModal').foundation('reveal', 'open');
$("#myButton").click(function() {
// This generates the error:
// Uncaught TypeError: Object [object Object] has no method 'foundation'
$('#myModal').foundation('reveal', 'open');
return false;
});
</script>
我怎样才能解决这个问题?仅当存在 Edge Animate 内容时才会出现该错误。删除后,它按预期工作。