简体   繁体   English

未捕获的类型错误:无法读取未定义的开发工具控制台的属性“top”

[英]Uncaught TypeError: Cannot read property 'top' of undefined dev tools console

I have code like this我有这样的代码

function (t, e, i, o) {
    "use strict";
    var s = t(".main-menu-wrap"), n = s.outerHeight() - s.outerHeight(), r = t(".header").next(".page-section"),
         a = r.position(), l = t(e).scrollTop();
    l >= a.top - n && s.addClass("fixedMenu"), t(e).scroll(function () {
        var i = t(e).scrollTop();
        i >= a.top - n ? s.addClass("fixedMenu") : s.removeClass("fixedMenu")
    }), t(".main-menu").singlePageNav({
        offset: t(".main-menu-bottom").outerHeight(),
        filter: ":not(.external)",
        updateHash: !0
    }), t(".manyItemsSlider").slick({
        infinite: !0,
        swipe: !0,
        slidesToShow: 5,
        slidesToScroll: 1,
        responsive: [{breakpoint: 992, settings: {slidesToShow: 3, slidesToScroll: 1}}, {
            breakpoint: 768,
            settings: {slidesToShow: 1, slidesToScroll: 1}
        }]
    }), t(".messagesSlider").slick({
        infinite: !0,
        swipe: !0,
        slidesToShow: 1,
        dots: !0,
        autoplay: !0,
        fade: !0,
        arrows: !1,
        slidesToScroll: 1
    }), t(".userFeedbackSlider").slick({
        infinite: !0,
        swipe: !0,
        slidesToShow: 2,
        dots: !0,
        autoplay: !0,
        fade: !1,
        arrows: !1,
        slidesToScroll: 1,
        responsive: [{breakpoint: 1200, settings: {slidesToShow: 1, slidesToScroll: 1}}]
    });
    var d = t(".toTop");
    d.length && d.on("click", function (e) {
        e.preventDefault(), t("html, body").animate({scrollTop: 0}, "slow")
    });
    var c = t(".scrollDown");
    c.length && c.on("click", function (i) {
        i.preventDefault();
        var o = t(e).height();
        t({myScrollTop: e.pageYOffset}).animate({myScrollTop: o}, {
            duration: 600, step: function (t) {
                e.scrollTo(0, t)
            }
        })
    })
}(jQuery, window, document);

In javascript console in dev tools In Chrome I have error: Uncaught TypeError: Cannot read property 'top' of undefined at main.js:1403 at main.js:1453.在开发工具的 javascript 控制台中在 Chrome 中我有错误:Uncaught TypeError: 无法读取at main.js:1403 at main.js:1453.未定义的属性 'top' at main.js:1403 at main.js:1453.

1403 is l >= a.top - n && s.addClass("fixedMenu"), t(e).scroll(function () { and 1453 is }(jQuery, window, document); 1403 是l >= a.top - n && s.addClass("fixedMenu"), t(e).scroll(function () {和 1453 是}(jQuery, window, document);

But in Firefox I have the following error: Uncaught TypeError: a is undefined js/main.js:1403 js/main.js:1453但是在 Firefox 中我有以下错误: Uncaught TypeError: a is undefined js/main.js:1403 js/main.js:1453

How can I fix this?我怎样才能解决这个问题?

Issue seems with a not being defined on function evaluation which stems from the fact that r wasn't defined in the line above, the cause for which could be header not present in the t supplied.问题似乎是在函数评估中未定义,这源于上一行中未定义 r 的事实,其原因可能是提供的 t 中不存在标头。 So, in a nutshell, check the first parameter being passed to this function因此,简而言之,检查传递给此函数的第一个参数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 控制台错误:未捕获TypeError:无法读取未定义的属性“顶部” - Console Error: Uncaught TypeError: Cannot read property 'top' of undefined 未捕获的类型错误:无法读取未定义的属性“顶部” - Uncaught TypeError: Cannot read property ‘top’ of undefined 未捕获的TypeError:无法读取未定义的属性“ top” - Uncaught TypeError: Cannot read property 'top' of undefined 未捕获的TypeError:无法读取未定义的属性“ top” - Uncaught TypeError: Cannot read property 'top' of undefined 未捕获的类型错误:无法读取未定义的属性“顶部” - Uncaught TypeError: Cannot read property 'top' of undefined 未捕获的TypeError:无法读取未定义的属性“ top” - Uncaught TypeError: Cannot read property 'top' of undefined 未捕获的类型错误:无法读取未定义的属性“msie” - jQuery 工具 - Uncaught TypeError: Cannot read property 'msie' of undefined - jQuery tools 购物车飞未捕获的TypeError:无法读取未定义的属性“顶部” - Cart to Fly Uncaught TypeError: Cannot read property 'top' of undefined 图表 JS 错误:未捕获的类型错误:无法读取未定义的属性“顶部” - Chart JS Error : Uncaught TypeError: Cannot read property 'top' of undefined jQuery Uncaught TypeError:无法读取未定义的属性“ top” - jQuery Uncaught TypeError: Cannot read property 'top' of undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM