Uncaught TypeError: Cannot read property 'top' of undefined foundation.magellan.js line 46

+1 vote
asked Oct 4, 2014 by no0bcoder

I am getting an error of, uncaught error when i click on any of the sub-navs, on my foundation magellan navigation. it is showing that top is not defined on the line 46 of the foundation.magellation.js please give any solution for the above.

//Account for expedition height if fixed position

     var scroll_top = target.offset().top - settings.destination_threshold + 1;//error
     scroll_top = scroll_top - expedition.outerHeight();


   <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>

  <script src="js/foundation/foundation.min.js"></script>
  <script src="js/foundation/foundation.magellan.js"></script>
       "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

1 Answer

0 votes
answered Oct 13, 2014 by dyne

Add data-magellan-destination attributes that correspond to the items in the sub-nav. It's trying to figure where it needs to scroll to and there is no target defined. For example, you might have sections further down the page with the attribute:

<div data-magellan-destination="home">home content here</div>
<div data-magellan-destination="catalogue">catalogue content here</div>


Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter