var tmemain = { pagenav : function () { var timer = null; var timer2 = null; function navlisttitle() { $('#nav-want-cont-wrap .nav-cont-wrap').stop(true, true).slideup(); $('#nav-cont-wrap .nav-cont-wrap').stop(true, true).delay(500).slidedown(); $("#nav-cont .nav-list").css({ "border-bottom" : "" }); } function navcontslide() { $('#nav-cont .navlist a').removeclass('active'); $('#nav-cont-wrap .nav-cont-wrap').find('ul').children().stop(true, false).slideup(500, function (e) { $("#nav-cont .nav-list").css({ "border-bottom" : "" }); }); } $(document).on('mouseenter', '#nav-cont .navlist div', function (e) { cleartimeout(timer2); timer = settimeout(function () { navlisttitle(); }, 500); }).on('mouseleave', '#nav-cont .navlist div', function (e) { cleartimeout(timer); timer2 = settimeout(function () { navcontslide(); $("#nav-cont-wrap").css({ "border-top" : "none" }); $("#nav-want-cont-wrap").css({ "border-top" : "none" }); }, 500); }) .on('mouseenter click', '#nav-cont .navlist a', function (e) { var $thisindex = $('#nav-cont a').index(this); var $oldindex = $('#nav-cont a').index($('#nav-cont a.active')); var delay_time = $('#nav-cont-wrap .nav-cont-wrap').find('ul').children(":visible").length === 0 ? 0 : 500; delay_time = 500; $('#nav-cont .navlist span.btn').removeclass('active'); $(this).addclass('active').siblings().removeclass('active'); $("#nav-cont .nav-list").css({ "border-bottom" : "" }); if ($oldindex >= 0) $('#nav-cont-wrap .nav-cont-wrap').find('ul').children().eq($oldindex).stop(true, true).delay(delay_time).slideup(); $('#nav-cont-wrap .nav-cont-wrap').find('ul').children().eq($thisindex).stop(true, true).delay(delay_time).slidedown(400, function () {}); if (!$(this).hasclass("js-no-menu")) return false; }) .on('mouseenter', '#nav-cont .navlist span.btn', function (e) { return; e.stoppropagation(); $(this).addclass('active'); $('#nav-want-cont-wrap .nav-cont-wrap').stop(true, true).slidedown(); }) .on('mouseleave', '#nav-cont .navlist span.btn', function (e) { return; e.stoppropagation(); $(this).removeclass('active'); $('#nav-want-cont-wrap .nav-cont-wrap').delay(500).slideup(); }) .on('mouseenter', '#nav-want-cont-wrap .nav-cont-wrap', function (e) { e.stoppropagation(); $('#nav-cont .navlist span.btn').trigger("mouseenter"); }) .on('mouseleave', '#nav-want-cont-wrap .nav-cont-wrap', function (e) { e.stoppropagation(); $('#nav-cont .navlist span.btn').trigger("mouseleave"); }) .on('mouseenter', '#nav-cont #nav-cont-wrap', function (e) { cleartimeout(timer2); }) .on('mouseleave', '#nav-cont #nav-cont-wrap', function (e) { timer2 = settimeout(function () { navcontslide(); }, 500); }); }, } !(function ($) { $(function ($) { tmemain.pagenav(); }); // eof dom ready })(jquery); // eof