Uncaught TypeError: Невозможно прочитать свойство 'top' из неопределенной строки foundation.magellan.js 46
Я получаю ошибку, неперехваченную ошибку, когда я нажимаю на любую из суб-навигаций в моей базовой навигации magellan. это показывает, что top не определен в строке 46 файла foundation.magellation.js, пожалуйста, дайте какое-либо решение для вышеупомянутого.
// Учет высоты экспедиции, если фиксированная позиция
var scroll_top = target.offset().top - settings.destination_threshold + 1;//error
scroll_top = scroll_top - expedition.outerHeight();
HTML: начало
<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>
1 ответ
Добавьте атрибуты data-magellan-destination, которые соответствуют элементам в суб-навигации. Он пытается выяснить, куда нужно перейти, и цель не определена. Например, у вас могут быть разделы внизу страницы с атрибутом:
<div data-magellan-destination="home">home content here</div>
<div data-magellan-destination="catalogue">catalogue content here</div>
и т.п.