首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未捕获的TypeError:无法读取未定义foundation.magellan.js行46的属性“”top“”

未捕获的TypeError:无法读取未定义foundation.magellan.js行46的属性“”top“”
EN

Stack Overflow用户
提问于 2014-10-04 21:54:02
回答 1查看 1.7K关注 0票数 1

当我在我的基础麦哲伦导航上点击任何子导航时,我得到了一个错误,未捕获的错误。它显示top没有在foundation.magellation.js的第46行上定义,请给出上述问题的任何解决方案。

//如果是固定位置,说明探险高度

代码语言:javascript
复制
     var scroll_top = target.offset().top - settings.destination_threshold + 1;//error
     scroll_top = scroll_top - expedition.outerHeight();

html:开始

代码语言:javascript
复制
   <DIV class="row">
   <div data-magellan-expedition="fixed">
   <ul class="sub-nav">
        <li data-magellan-arrival="home"><a href="#home">Home</a></li>
        <li data-magellan-arrival="catalogue"><a href="#catalogue">Catalogue</a></li>
        <li data-magellan-arrival="about"><a href="#js">About Us</a></li>
        <li data-magellan-arrival="contact"><a href="#js">Contact Us</a></li>
   </ul>
   </div>
   </div> 


  /*end*/ 
  <script src="js/foundation/foundation.min.js"></script>
  <script src="js/foundation/foundation.magellan.js"></script>
   <script>
   $(document).foundation({
       "magellan-expedition": {
       active_class: 'active', // specify the class used for active sections
       threshold: 0, // how many pixels until the magellan bar sticks, 0 = auto
       destination_threshold: 10, 
       throttle_delay: 50, // calculation throttling to increase framerate
       fixed_top: 0, // top distance in pixels assigned to the fixed element on scroll
   }
    });
    $(document).foundation();
   </script>
   </body>
   </html>
EN

回答 1

Stack Overflow用户

发布于 2014-10-14 04:32:20

添加与子导航中的项目相对应的data-magellan-destination属性。它正在尝试计算需要滚动到的位置,但没有定义目标。例如,您可能会在页面下面的部分中使用以下属性:

代码语言:javascript
复制
<div data-magellan-destination="home">home content here</div>
<div data-magellan-destination="catalogue">catalogue content here</div>

等。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26193489

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档