/** * 杞挱鍥炬晥鏋渏s */ /* var wrap = document.querySelector(".wrap"); var next = document.querySelector(".arrow_right"); var prev = document.querySelector(".arrow_left"); next.onclick = function () { next_pic(); } prev.onclick = function () { prev_pic(); } function next_pic () { index++; if(index > 4){ index = 0; } showCurrentDot(); var newLeft; if(wrap.style.left === "-3600px"){ newLeft = -1200; }else{ newLeft = parseInt(wrap.style.left)-600; } wrap.style.left = newLeft + "px"; } function prev_pic () { index--; if(index < 0){ index = 4; } showCurrentDot(); var newLeft; if(wrap.style.left === "0px"){ newLeft = -2400; }else{ newLeft = parseInt(wrap.style.left)+600; } wrap.style.left = newLeft + "px"; } var timer = null; function autoPlay () { timer = setInterval(function () { next_pic(); },2000); } autoPlay(); var container = document.querySelector(".container"); container.onmouseenter = function () { clearInterval(timer); } container.onmouseleave = function () { autoPlay(); } var index = 0; var dots = document.getElementsByTagName("span"); function showCurrentDot () { for(var i = 0, len = dots.length; i < len; i++){ dots[i].className = ""; } dots[index].className = "on"; } for (var i = 0, len = dots.length; i < len; i++){ (function(i){ dots[i].onclick = function () { var dis = index - i; if(index == 4 && parseInt(wrap.style.left)!==-3000){ dis = dis - 5; } //鍜屼娇鐢╬rev鍜宯ext鐩稿悓锛屽湪鏈�寮�濮嬬殑鐓х墖5鍜屾渶缁堢殑鐓х墖1鍦ㄤ娇鐢ㄦ椂浼氬嚭鐜伴棶棰橈紝瀵艰嚧绗﹀彿鍜屼綅鏁扮殑鍑洪敊锛屽仛鐩稿簲鍦板鐞嗗嵆鍙� if(index == 0 && parseInt(wrap.style.left)!== -600){ dis = 5 + dis; } wrap.style.left = (parseInt(wrap.style.left) + dis * 600)+"px"; index = i; showCurrentDot(); } })(i); }*/ var mySwiper = new Swiper ('.swiper-container', { // 婊氬姩鏂瑰悜 horizontal/vertical direction: 'horizontal', // 鑷姩鎾斁 autoplay:2000, // 鏄惁寰幆鎾斁 loop: true, // 濡傛灉闇�瑕佸垎椤靛櫒锛堝皬鍦嗙偣锛� // 鏄惁闇�瑕佸垎椤靛櫒 pagination: '.swiper-pagination', // 鐐瑰嚮鍒嗛〉鍣ㄦ槸鍚﹀垏鎹㈠埌瀵瑰簲鐨勫浘鐗� 鏄� true 鍚� false paginationClickable:true, // 濡傛灉闇�瑕佸墠杩涘悗閫�鎸夐挳 nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', // 鐢ㄦ埛鎿嶄綔swiper涔嬪悗锛屾槸鍚︾姝utoplay銆傞粯璁や负true锛氬仠姝€�� // 濡傛灉璁剧疆涓篺alse锛岀敤鎴锋搷浣渟wiper涔嬪悗鑷姩鍒囨崲涓嶄細鍋滄锛屾瘡娆¢兘浼氶噸鏂板惎鍔╝utoplay銆� // 鎿嶄綔鍖呮嫭瑙︾锛屾嫋鍔紝鐐瑰嚮pagination绛夈�� autoplayDisableOnInteraction:false, }) $(function(){ var thisTime; //榧犳爣绂诲紑宸︿晶鍐呭鏍� $('.cat_wrap .cat_list .float').mouseleave(function(even){ thisTime = setTimeout(thisMouseOut,1000); }); //榧犳爣鐐瑰嚮宸︿晶鍐呭鏍� 婊戝姩鍑哄脊灞� $('.cat_wrap .cat_list .float').mouseenter(function(){ $(this).addClass("active").siblings().removeClass("active"); clearTimeout(thisTime); var thisUB = $('.cat_wrap .cat_list .float').index($(this)); if($.trim($('.cat_subcont .cat_sublist').eq(thisUB).html()) != ""){ $('.cat_subcont').addClass('active'); $('.cat_sublist').hide(); $('.cat_sublist').eq(thisUB).show(); }else{ $('.cat_subcont').removeClass('active'); } }); //鍑芥暟鈥斺�旀墽琛岄紶鏍囩寮�宸︿晶鍐呭鏍忕殑鍔ㄤ綔 function thisMouseOut(){ $('.cat_subcont').removeClass('active'); $('.cat_wrap .cat_list .float').removeClass('active'); } $('.cat_subcont').mouseenter(function(){ clearTimeout(thisTime); $('.cat_subcont').addClass('active'); }); $('.cat_subcont').mouseleave(function(){ $('.cat_subcont').removeClass('active'); $('.cat_wrap .cat_list .float').removeClass('active'); }); });