@Vlastev

Почему не сворачивается меню при клике на бургер?

Гамбургер-меню bootstrap не сворачивается в мобильной версии.
Сам код:
var _otmSearch = typeof ot === "undefined" ? "/s" : ot._otmSearch || "/s";
var _otmLogoFallback = "КРИПТИМ";
var _otmLogo =
    typeof ot === "undefined"
        ? typeof _otmLogo === "undefined"
            ? _otmLogoFallback
            : _otmLogo
        : typeof ot._otmLogo === "undefined"
        ? typeof ot.theme_full_name === "undefined"
            ? _otmLogoFallback
            : ot.theme_full_name
        : '<img src="' + ot._otmLogo + '" alt="" />';
var _otmBackTop = typeof ot === "undefined" ? true : typeof ot._otmBackTop === "undefined" ? true : ot._otmBackTop;
var _otmBackTopContent = typeof ot === "undefined" ? '<i class="material-icons">keyboard_arrow_up</i>' : typeof ot._otmBackTopContent === "undefined" ? '<i class="material-icons">keyboard_arrow_up</i>' : ot._otmBackTopContent;
var _otmBackTopPos = typeof ot === "undefined" ? 300 : typeof ot._otmBackTopPos === "undefined" ? 300 : ot._otmBackTopPos;
var _otmBackTopSpeed = typeof ot === "undefined" ? 80 : typeof ot._otmBackTopSpeed === "undefined" ? 80 : ot._otmBackTopSpeed;
(function () {
    Array.prototype.forEach2 = function (g) {
        var f = this.length;
        for (var h = 0; h < f; h++) {
            g(this[h], h);
        }
    };
    function b(j) {
        var f = document.getElementsByTagName("*"),
            h,
            g = [];
        for (h in f) {
            if ((" " + f[h].className + " ").indexOf(" " + j + " ") > -1) {
                g.push(f[h]);
            }
        }
        return g;
    }
    if (typeof document.getElementById("boxed") != "undefined") {
        document
            .getElementById("boxed")
            .insertAdjacentHTML(
                "beforeend",
                '<div class="ot-responsive-menu-header"><a href="#" id="ot-menu-burger-1" class="ot-responsive-menu-header-burger"></a><a href="/" class="ot-responsive-menu-header-logo">' +
                    _otmLogo +
                    '</a><span id="ot-responsive-menu-header-list"></span></div>'
            );
        document.body.insertAdjacentHTML(
            "beforeend",
            '<div class="ot-responsive-menu-content-c-header"><a href="#" id="ot-menu-burger-2" class="ot-responsive-menu-header-burger"></a></div><div class="ot-responsive-menu-content"><div class="ot-responsive-menu-content-inner has-search"><form action="' +
                _otmSearch +
                '" method="post"><input type="text" name="story" placeholder="Введите слово для поиска..." /><input type="hidden" name="do" value="search" /><input type="hidden" name="subaction" value="search" /><button type="submit"></button></form><ul id="responsive-menu-holder"></ul></div></div><div class="ot-responsive-menu-background"></div>'
        );
        if (_otmBackTop) {
            document.body.insertAdjacentHTML("beforeend", '<a href="#top" id="otm-back-to-top">' + _otmBackTopContent + "</a>");
        }
        b("load-responsive-bar").forEach2(function (f) {
            var g = document.getElementById("ot-responsive-menu-header-list").innerHTML;
            document.getElementById("ot-responsive-menu-header-list").innerHTML = g + f.innerHTML;
        });
        b("load-responsive").forEach2(function (f) {
            var g = document.getElementById("responsive-menu-holder").innerHTML;
            document.getElementById("responsive-menu-holder").innerHTML = g + f.innerHTML;
        });
        document.getElementById("ot-menu-burger-1").addEventListener("click", function (g) {
            g.preventDefault();
            var f = "-" + parseInt(window.pageYOffset, 10) + "px";
            if (!document.body.classList.contains("nomorefixd")) {
                document.body.classList.add("ot-responsive-menu-show");
                document.body.classList.add("nomorefixd");
                document.getElementById("boxed").style.marginTop = f;
            }
            window.scrollTo(0, f);
            return false;
        });
        document.getElementById("ot-menu-burger-2").addEventListener("click", function (f) {
            f.preventDefault();
            document.getElementById("boxed").click();
            return false;
        });
        document.getElementById("boxed").addEventListener("click", function (g) {
            var f = typeof g.toElement != "undefined" ? g.toElement : g.target;
            if (!f.classList.contains("ot-responsive-menu-header-burger") && document.body.classList.contains("nomorefixd") && document.body.classList.contains("ot-responsive-menu-show")) {
                document.body.classList.remove("ot-responsive-menu-show");
                setTimeout(function () {
                    var h = Math.abs(parseInt(document.getElementById("boxed").style.marginTop, 10));
                    document.getElementById("boxed").removeAttribute("style");
                    document.body.classList.remove("nomorefixd");
                    window.scrollTo(0, h);
                }, 200);
            }
        });
        var a = false;
        var d = function (g) {
            if (!a) {
                return false;
            }
            var f = window.pageYOffset | document.body.scrollTop;
            if (typeof g === "undefined") {
                g = f;
            }
            if (f > 0) {
                window.scrollTo(0, g - 10 * (_otmBackTopSpeed / 10));
                setTimeout(function () {
                    d(Math.max(g - 10 * (_otmBackTopSpeed / 10), 0));
                }, 100 / (_otmBackTopSpeed / 10));
            } else {
                a = false;
            }
        };
        document.getElementById("otm-back-to-top").addEventListener("click", function (f) {
            f.preventDefault();
            a = true;
            d();
            return false;
        });
    }
    var e = false,
        c = [];
    b("otm-follow").forEach2(function (f) {
        c.push(f);
    });
    window.onscroll = function () {
        var f = window.pageYOffset | document.body.scrollTop;
        if (_otmBackTop) {
            var g = document.getElementById("otm-back-to-top");
            if (f >= _otmBackTopPos && !g.classList.contains("active")) {
                g.classList.add("active");
            } else {
                if (f < _otmBackTopPos && g.classList.contains("active")) {
                    g.classList.remove("active");
                }
            }
        }
        c.forEach2(function (h) {
            if (typeof h == "undefined" || h.offsetParent == null) {
                return false;
            }
            var i = h.offsetTop + h.offsetParent.offsetTop;
            if (f >= i && !h.classList.contains("is-now-following")) {
                h.style.height = h.offsetHeight + "px";
                h.style.width = h.offsetWidth + "px";
                h.classList.add("is-now-following");
            } else {
                if (f < i && h.classList.contains("is-now-following")) {
                    h.classList.remove("is-now-following");
                    h.removeAttribute("style");
                }
            }
        });
    };
    window.onresize = function () {
        c.forEach2(function (f) {
            f.style.width = "auto";
            f.style.width = f.width + "px";
        });
    };
})();


ссылка на сайт: https://kriptim.fun
  • Вопрос задан
  • 108 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы