/** * js加载完成 */ $(function () { /** * 通用列表样式 */ $( "ul.col-2 li:nth-child(2n+2),ul.col-3 li:nth-child(3n+3),ul.col-4 li:nth-child(4n+4),ul.col-5 li:nth-child(5n+5),ul.col-6 li:nth-child(6n+6),ul.col-7 li:nth-child(7n+7)" ).css("margin-right", "0"); $( "ul.col-2 li:nth-child(2n+2),ul.col-3 li:nth-child(3n+3),ul.col-4 li:nth-child(4n+4),ul.col-5 li:nth-child(5n+5),ul.col-6 li:nth-child(6n+6),ul.col-7 li:nth-child(7n+7)" ).addClass("nomargin"); /** * 导航交互 */ $(".main_nav li").each(function (key) { var line = $(this).children(".subscript"); var secondList = $(".second_nav_lists")[key - 1]; $(this).hover( function () { if (!$(this).hasClass("active")) { line .stop(true, true) .animate({ bottom: "5px" }, 300 ) .animate({ bottom: "0" }, 200 ); } $(secondList) .css({ zIndex: 1 }) .stop(true, false) .animate({ bottom: -$(secondList).height() + "px" }, 400 ); }, function () { if (!$(this).hasClass("active")) { line.stop(true, true).animate({ bottom: "-5px" }, 300 ); } $(secondList) .css({ zIndex: 0 }) .stop(true, false) .animate({ bottom: 0 }, 400 ); } ); }); }) //禁止滚动条滚动 function unScroll() { var top = $(document).scrollTop(); $(document).on('scroll.unable', function (e) { $(document).scrollTop(top); }) } //移除禁止滚动条滚动 function removeUnScroll() { $(document).unbind("scroll.unable"); }