$('.M-box11').pagination({ mode: 'fixed' }); $(function () { const localUrl = location.href; //鑾峰彇褰撳墠椤甸摼鎺 var clsDatArr = localUrl.split("/"); //鍒囧壊閾炬帴缁勬垚鏁扮粍 var indexz = clsDatArr[clsDatArr.length - 1].substring(0, clsDatArr[clsDatArr.length - 1].indexOf('.')); $('.hw-list li').eq(indexz).addClass('active'); $('.hw-list li').eq(indexz).siblings('li').removeClass('active'); $('.hw-description:eq(' + indexz + ')').siblings('.hw-description').hide(); $('.hw-description:eq(' + indexz + ')').show(); // mobile瑙e喅鏂规灞曠ず $("#hardware-list>li>.child_menu").eq(indexz).slideToggle(); $("#hardware-list>li>.child_menu").eq(indexz).parent().siblings("li").find(".child_menu").slideUp(); }); $(function () { var index = 0; $('.hw-list li').click(function () { index = $(this).index(); $(this).addClass('active').siblings('li').removeClass('active'); $('.hw-description:eq(' + index + ')').siblings('.hw-description').hide(); $('.hw-description:eq(' + index + ')').show(); }) // 宸︿晶鎼滅储鎮诞 $(window).scroll(function () { //杩欏効杩欎釜200鏄綘鐨勫鑸爮浠ヤ笂 鐨勫厓绱犻珮搴 var maxHeight = parseInt($('.hw-description:eq(' + index + ')').height()) + parseInt($( ".hw-content").offset().top) - parseInt($(".hw-screen").height()); // console.log($(window).scrollTop(), maxHeight, $('.hw-description:eq(' + index + ')') // .height(), $(".hw-content").offset().top); if ($(window).scrollTop() > $(".hw-content").offset().top && $(window).scrollTop() < maxHeight) { $(".hw-screen").css("position", "fixed"); $(".hw-screen").css("top", "130px"); } else if ($(window).scrollTop() >= maxHeight) { $(".hw-screen").parent().css("position", "relative"); $(".hw-screen").css("position", "absolute"); $(".hw-screen").css("top", parseInt($(".hw-screen").parent().height()) - parseInt($( ".hw-screen").height() + 40)); } else { $(".hw-screen").css("position", "static") } }); }); // mobile瑙e喅鏂规灞曠ず $(function () { $("#hardware-list").on("click", ".liname", function (index) { var index = $("#hardware-list .liname").index(this); $("#hardware-list>li>.child_menu").eq(index).slideToggle(); $("#hardware-list>li>.child_menu").eq(index).parent().siblings("li").find(".child_menu") .slideUp(); }); });