var drag=function(obj){ obj.bind("mousedown",start); function start(event){ if(event.button==0 || (event.button==1 && checkletie9())){//判断是否点击鼠标左键 gapx=event.clientx; startx = obj.scrollleft(); // scroll的初始位置 //movemove事件必须绑定到$(document)上,鼠标移动是在整个屏幕上的 $(document).bind("mousemove",move); //此处的$(document)可以改为obj $(document).bind("mouseup",stop); } console.log(event.button) return false;//阻止默认事件或冒泡 } function move(event){ var left = event.clientx-gapx; // 鼠标移动的相对距离 obj.scrollleft(startx - left ); return false;//阻止默认事件或冒泡 } function stop(){ //解绑定,这一步很必要,前面有解释 $(document).unbind("mousemove",move); $(document).unbind("mouseup",stop); } } function checkletie9() { var theua = window.navigator.useragent.tolowercase(); if ((theua.match(/msie\s\d+/) && theua.match(/msie\s\d+/)[0]) || (theua.match(/trident\s?\d+/) && theua.match(/trident\s?\d+/)[0])) { var ieversion = theua.match(/msie\s\d+/)[0].match(/\d+/)[0] || theua.match(/trident\s?\d+/)[0]; if (ieversion <= 9) { return true; } } return false; } function getqueryvariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i'; html += '
'; }else{ html += '
'+ data[j] +'
'; html += '
'; } } html += ''; }else if(data[0] == "none") { html += '
'; html += '
'; html += ''; html += '
'; html += '
'; } if(data[0] == "") { html += '
'; html += '
'; html += ''; html += '
'; html += '
'; } html += '
'+ list[i].des +'
'; if(list[i].btn) { html += '
点击查看荣誉
'; } html += ''; html += ''; } $(".about .content .tab6 .about-swiper .swiper-container .swiper-wrapper").append(html); if(myswiper) { myswiper.destroy(); } // 企业荣誉swiper myswiper = new swiper('.swiper-container',{ slidesperview : 3, }) myswiper.reinit(); myswiper.swipeto(0, 0, false); // 详情点击 $(".about .content .tab6 .about-swiper .container .btn").click(function() { var parent = $(this).attr("data-parent"); var index = $(this).attr("data-index"); $(".about .content .tab6 .container1").hide(); $(".about .content .tab6 .container2 .img img").attr("src", aboutlist[parent][index].img); $(".about .content .tab6 .container2 .des p").text(aboutlist[parent][index].des); $(".about .content .tab6 .container2").fadein(); }) // 点击返回 $(".about .content .tab6 .container2 .btn").click(function() { $(".about .content .tab6 .container2").hide(); $(".about .content .tab6 .container1").fadein(); }) // 下一个 $(".about .content .tab6 .container1 .btn-next").click(function() { myswiper.swipenext(); }) $(".about .content .tab6 .container1 .btn-pre").click(function() { myswiper.swipeprev(); }) } })