锘 function Slider(oSlider, oTrigger, auto) { this.init(oSlider, oTrigger, auto); } Slider.prototype = { mouseover: function(targetIndex) { var curLi = this.aLi[this.curIndex],//瑜版挸澧犻崶鍓у targetLi = this.aLi[targetIndex];//閻?#57789;鐖i崶鍓у curLi.style.zIndex = 1; targetLi.style.zIndex = 2; //閺囧瓨鏁艰ぐ鎾冲闁鑵戦惃鍓唒an this.aSpan[this.curIndex].className = ''; this.aSpan[targetIndex].className = 'cur'; startMove(curLi, {'opacity': 0}); startMove(targetLi, {'opacity': 100}); this.curIndex = targetIndex;//閺囧瓨鏌婅ぐ鎾冲缁便垹绱 }, mouseout: function(targetIndex) {//mouseout閺?#65533;,瀵偓閸?#57885;鍤滈崝銊ㄧ枂閹?#65533; this.auto(); }, auto: function() { clearInterval(this.timer) var that = this; this.timer = setInterval(function() {//閼?#57412;濮╂潪鎸?閸掑洦宕查柅鐔峰娑?#65533;5000濮?#57508; that.mouseover((that.curIndex+1)%that.aLi.length); }, 5000); }, init: function(oSlider, oTrigger, auto) { this.oSlider = oSlider;//楠炶崵浼呴悧鍥?#57744;閸?#65533; this.oTrigger = oTrigger;//楠炶崵浼呴悧鍥曢崣鎴濇珤鐎圭懓娅 this.aLi = this.oSlider.getElementsByTagName('li');//閸ュ墽澧 this.aSpan = [];//楠炶崵浼呴悧鍥曢崣鎴濇珤 this.curIndex = 0;//瑜版挸澧犻崶鍓у缁便垹绱?姒涙0 this.timer = null;//閼?#57412;濮╂潪鎸 var i, len; //閻㈢喐鍨歴pan for (i = 0, len = this.aLi.length; i < len; i++) { var newSpan = document.createElement('span'); this.aSpan.push(newSpan); this.oTrigger.appendChild(newSpan); } //閸掓繂閸栨牜娑撯偓瀵姴娴橀悧鍥ㄦ▔缁€� this.aSpan[0].className = 'cur'; startMove(this.aLi[0], {'opacity': 100}); var that = this; for (i = 0; i < len; i++) {//缂佹垵鐣緈ouseover閸滃ouseout娴滃娆 this.aSpan[i].onmouseover = (function(i) { return function() { if (i == this.curIndex) {//婵″倹鐏夐惄鐖g粵澶夌艾瑜版挸澧?閸掓瑤绗夐幍褑 return ; } clearInterval(this.timer);//濞撳懘娅庨懛濮╂潪鎸 that.mouseover(i); } })(i); if (auto) {//閸掋倖鏌囬弰鎯侀懛濮╂潪鎸?閸氾箑鍨稉宥囩拨鐎规矮绨ㄦ禒� this.aSpan[i].onmouseout = (function(i) { return function() { that.mouseout(i); } })(i); } } if (auto) {//閸掋倖鏌囬弰鎯侀懛濮╂潪鎸 this.auto(); } } } //閸ュ墽澧栭懛鈧倸绨茬紓鈺傛杹 function drawImage(oImg,iWidth,iHeight) { //閸欏倹鏆?閸ュ墽澧?閸忎浇閻ㄥ嫬鎼?#65533;,閸忎浇閻ㄥ嫰鐝惔�) var image = new Image(); image.src = oImg.src; if(image.width>0 && image.height>0){ if(image.width/image.height >= iWidth/iHeight){ if(image.width > iWidth){ oImg.width = iWidth; oImg.height = (image.height*iWidth)/image.width; }else{ oImg.width = image.width; oImg.height = image.height; } }else{ if(image.height > iHeight){ oImg.height = iHeight; oImg.width = (image.width*iHeight)/image.height; }else{ oImg.width = image.width; oImg.height = image.height; } } } } function stopDefault(e) {// 缁備焦濞村繗閸c劑绮拋銈?#58641;娑?#65533; var e= e || event; if (e.preventDefault) { e.preventDefault(); } else { window.event.returnValue = false; } return false; } //濡剝瀚欏姘З閺?#65533; function ImitateScroll(scrollBox, scrollObj, scrollBar, scrollBtn) {//scrollBox鐞?#57507;绮撮崝銊?#57838;鐠炩€?#58939;濡楀棴绱漵crollObj鐞?#57507;绮撮崝銊?#57838;鐠炩槄绱漵crollBar濠婃艾濮╅弶鈥虫健閿涘本绮撮崝銊︽蒋閹稿鎸 this.init(scrollBox, scrollObj, scrollBar, scrollBtn); } ImitateScroll.prototype = { scale:function() {//鐞?#57507;绮撮崝銊?#57838;鐠炩€茬瑢鐞?#57507;绮撮崝銊?#57838;鐠炩€?#58939;濡楀棛娈戞妯哄濮f柧绶ョ拋锛勭暬 return (this.scrollObj.scrollHeight/this.scrollBox.clientHeight); }, scrollBtnMouseDown:function(ev) {//濠婃艾濮╅幐澶愭尦閹稿绗 var _this = this; var disY = ev.clientY - this.scrollBtn.offsetTop;//姒х姵鐖閸ф劖鐖g捄婵?#59271;濠婃艾濮╅幐澶愭尦婢舵挳鍎撮惃鍕獩缁?#65533; var maxTop = this.scrollBar.clientHeight - this.scrollBtn.offsetHeight; document.onmousemove = function(ev) { if (document.all) {//ie 缁備焦闁瀚 document.body.onselectstart = new Function("return false"); } else {// chrome, ff document.body.className = "chromeOnselectstart"; } var oEvent = ev || event; var t = oEvent.clientY - disY; t = t>maxTop ? maxTop : t; t = t<0 ? 0 : t; _this.scrollBtn.style.top = t + "px"; _this.scrollObj.style.top = -t / _this.scrollBar.clientHeight * _this.scrollObj.scrollHeight + "px"; }; document.onmouseup = function() { if (document.all) {//ie 鐟欙綁娅庣粋浣?#57627;闁瀚 document.body.onselectstart = new Function("return true"); } else {// chrome, ff document.body.className = ""; } document.onmousemove = document.onmouseup = null;//濞撳懘娅巑ove閸滃瘈p娴滃娆 }; }, scrollBoxMousewheel:function(ev) {//姒х姵鐖e姘崇枂濠婃艾濮 var direct = 0; var topCur = this.scrollBtn.offsetTop; var maxTop = this.scrollBar.clientHeight - this.scrollBtn.offsetHeight; //濠婃俺鐤嗗В蹇?#57532;濠婃艾濮╅敍灞剧泊閸斻劍瀵滈柦鐠ф壆娈戠捄婵?#59271;閿涘本绁寸拠鏄猦rome濠?#65533;8濞嗏€虫▕娑撳秴娑撯偓鐏?#65533; var directTop = this.scrollBox.clientHeight / 8 / this.scrollObj.scrollHeight * this.scrollBar.clientHeight; directTop = directTop>0 ? Math.ceil(directTop) : Math.floor(directTop); stopDefault(ev);//缁備焦濞村繗閸c劏鍤滈煬娈戝姘З閺夆剝绮撮崝銊︽櫏閺?#65533; if (ev.wheelDelta) {//IE/Opera/Chrome direct = ev.wheelDelta; } else if (ev.detail) {//Firefox direct = ev.detail * (-1); } if(parseFloat(direct) > 0) { var topEnd = topCur - directTop; if (topEnd < 0) {topEnd = 0;} } else { var topEnd = topCur + directTop; topEnd = topEnd>maxTop ? maxTop : topEnd; } this.scrollBtn.style.top = topEnd + "px"; this.scrollObj.style.top = -topEnd / this.scrollBar.clientHeight * this.scrollObj.scrollHeight + "px"; }, init:function(scrollBox, scrollObj, scrollBar, scrollBtn) {//閸掓繂閸?#65533; this.scrollBox = typeof scrollBox == "string" ? document.getElementById(scrollBox) : scrollBox; this.scrollObj = typeof scrollObj == "string" ? document.getElementById(scrollObj) : scrollObj; this.scrollBar = typeof scrollBar == "string" ? document.getElementById(scrollBar) : scrollBar; this.scrollBtn = typeof scrollBtn == "string" ? document.getElementById(scrollBtn) : scrollBtn; var scale = this.scale();////鐞?#57507;绮撮崝銊?#57838;鐠炩€茬瑢鐞?#57507;绮撮崝銊?#57838;鐠炩€?#58939;濡楀棛娈戞妯哄濮f柧绶 if (scale <= 1) {//閸掋倖鏌囬弰鎯佹潏鎯у煂娴溠呮晸濠婃艾濮╅弶锛勬畱閺夆€叉 this.scrollBar.style.display = "none"; return; } else { this.scrollBar.style.display = "block"; } // if(_this.scrollObj.scrollHeight+_this.scrollObj.offsetTop < _this.scrollBox.clientHeight) // {//閸掋倖鏌囩悮绮撮崝銊?#57838;鐠炩剝妲搁崥锔界泊鏉╁洤銇旀禍� // _this.scrollObj.style.top = _this.scrollBox.clientHeight-_this.scrollObj.scrollHeight+"px"; // } //閸掓繂閸栨牗绮撮崝銊﹀瘻闁?#57790;娈戞妯哄閸滃op閸?#65533; this.scrollBtn.style.height = this.scrollBar.clientHeight / scale + "px";//鐠佹儳鐣惧姘З閹稿鎸抽惃鍕彯鎼?#65533; //this.scrollBtn.style.top = -this.scrollObj.offsetTop/this.scrollObj.scrollHeight*this.scrollBar.clientHeight + "px"; var _this = this; this.scrollBtn.onmousedown = function(e) {//濠婃艾濮╅幐澶愭尦閹锋牗瀚挎禍瀣╂ var e = e || event; _this.scrollBtnMouseDown(e); }; //缂佹垵鐣惧姘崇枂娴滃娆 if (this.scrollBox.addEventListener) {//ff3.5娴犮儰绗 this.scrollBox.addEventListener("DOMMouseScroll", function(e) { var e = e || event; _this.scrollBoxMousewheel(e) }, false); } //W3C this.scrollBox.onmousewheel = function(e) { var e = e || event; _this.scrollBoxMousewheel(e) }; //IE/Opera/Chrome } } $(function() { var curNavId; var subnavTimer; var url = document.URL; var navRgExp = { "sub1": /\/product/, "sub2": /\/solution/, "sub3": /\/service/, "sub4": /\/about/, "sub5": /\/news/, "sub6": /\/dealer/ } for (var i in navRgExp) { if (navRgExp[i].test(url)) { curNavId = i; break ; } } $(".nav .navs").hover(function() { clearInterval(subnavTimer); var index = $(this).index(); if (index == 5) { $(".nav .navs").removeClass("cur"); $(".subNav div[dataType=subnav]").hide(); return; } $(this).addClass("cur").siblings(".navs").removeClass("cur"); $(".subNav div[dataType=subnav]").eq(index).slideDown(300).siblings("div[dataType=subnav]").stop().hide(); }, function() { var that = $(this); subnavTimer = setTimeout(function() { var index = that.index(); that.removeClass("cur"); $(".subNav div[dataType=subnav]").eq(index).hide(); $("#" + curNavId).addClass("cur"); }, 100); }); $(".subNav div[dataType=subnav]").hover(function() { clearInterval(subnavTimer); }, function() { var that = $(this); subnavTimer = setTimeout(function() { var index = that.index(); $(".nav .navs").eq(index).removeClass("cur"); $("#" + curNavId).addClass("cur"); that.hide(); }, 100); }); // $(".subNav .cont2 .title li").mouseover(function() { // $(this).addClass("cur").siblings("li").removeClass("cur"); // var index = $(this).index(); // $(".subNav .cont2 .list").hide().eq(index).show(); // }); }) function getParam(paramName) { paramValue = "", isFound = !1; if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) { arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0; while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++ } return paramValue == "" && (paramValue = null), paramValue }