$(function () { // const globaldata = { // }; $(".my-nav").click(function (e) { let active = Array.prototype.slice.call($(this).find("li")).indexOf(e.target); if (active == globaldata.active) return false; globaldata.active = active; $(this).find(".active").removeClass("active"); $(e.target).addClass("active"); }) $("[data-click='open']").click(function () { let bool = $(this).data("open"); if (!bool) { $(this).data("open", true).children("i").removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up").parent().parent().parent().addClass("edi-body-height"); } else { $(this).data("open", false).children("i").removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down").parent().parent().parent().removeClass("edi-body-height"); } }) })