1// JavaScript Document 2 3$(document).ready(function(){ 4 //banner 5 var isIE=!!window.ActiveXObject, 6 isIE6=isIE&&!window.XMLHttpRequest, 7 isIE8=isIE&&!!document.documentMode, 8 isIE7=isIE&&!isIE6&&!isIE8; 9 var _bLen = $(".banner").length; 10 if(_bLen>1){ 11 var _bauto = false; 12 }else{ 13 var _bauto = true; 14 } 15 for(var ba=0;ba<_bLen;ba++){ 16 if($(".banner").eq(ba).find("li").length>0){ 17 bannerScroll($(".banner").eq(ba)); 18 } 19 } 20 function bannerScroll(obj){ 21 var _this = $(obj), 22 _obj = _this.find(".pic"), 23 _len = _obj.find("li").length-1, 24 move = _this.find(".pic ul")[0], 25 _liw = _obj.width(), 26 _ulw = _len*_liw, 27 _windowW = $(window).width(), 28 defaultX=0, 29 startX, 30 startY, 31 speed = 500, 32 long = -50, 33 touchx, 34 touchgo, 35 autotime = 5000; 36 page = 0; 37 if(_liw<=480){ 38 _obj.find("li").css({"width":_liw,"max-height":_liw/960*540}).addClass("active").show(); 39 }else if(_liw<=768){ 40 _obj.find("li").css({"width":_liw,"max-height":_liw/1536*800}).addClass("active").show(); 41 }else{ 42 _obj.find("li").css({"width":_liw,"max-height":_liw/1920*600}).addClass("active").show(); 43 } 44 _this.find(".thumb").html(''); 45 for(var bt=0;bt<=_len;bt++){ 46 _this.find(".thumb").append('<span></span>'); 47 } 48 _this.find(".thumb span").eq(0).addClass("active"); 49 function touchStart(event) { 50 clearInterval(touchgo); 51 var touch = event.touches[0]; 52 startX = touch.pageX; 53 if(move.style.left){ 54 defaultX = parseFloat(move.style.left); 55 } 56 } 57 function touchMove(event) { 58 event.preventDefault(); 59 var touch = event.touches[0]; 60 if(parseFloat(move.style.left)>=-long){ 61 $(move).css("left","50px"); 62 }else if(parseFloat(move.style.left)<=-_ulw+long){ 63 $(move).css("left",-_ulw+long); 64 }else{ 65 var x = defaultX+touch.pageX - startX; 66 $(move).css("left",x); 67 touchx = x-defaultX; 68 } 69 } 70 function touchEnd(event) { 71 if (!isIE6 && !isIE7 && !isIE8){ 72 move.removeEventListener("touchstart", touchStart, false); 73 move.removeEventListener("touchmove", touchMove, false); 74 move.removeEventListener("touchend", touchEnd, false); 75 } 76 var _left = parseFloat(move.style.left); 77 if(_left>0){ 78 page=0; 79 $(move).animate({ 80 left:0 81 },speed,function(){ 82 addEventTouch(); 83 }); 84 }else if(touchx<long&&page<_len){ 85 page++; 86 $(move).animate({ 87 left:-(page*_liw) 88 },speed,function(){ 89 addEventTouch(); 90 }); 91 }else if(touchx<-long){ 92 $(move).animate({ 93 left:-(page*_liw) 94 },speed,function(){ 95 addEventTouch(); 96 }); 97 }else if(touchx>-long){ 98 page--; 99 $(move).animate({ 100 left:-(page*_liw) 101 },speed,function(){ 102 addEventTouch(); 103 }); 104 } 105 _this.find(".thumb span").removeClass("active").eq(page).addClass("active"); 106 if(_bauto){ 107 touchgo = setTimeout('autoTouch()', autotime); 108 } 109 } 110 addEventTouch = function(){ 111 if (!isIE6 && !isIE7 && !isIE8){ 112 move.addEventListener("touchstart", touchStart, false); 113 move.addEventListener("touchmove", touchMove, false); 114 move.addEventListener("touchend", touchEnd, false); 115 } 116 } 117 addEventTouch(); 118 autoTouch = function(){ 119 clearInterval(touchgo); 120 if(page<_len){ 121 page++; 122 $(move).animate({ 123 left:-(page*_liw) 124 },speed); 125 }else if(page>=_len){ 126 $(move).animate({ 127 left:0 128 },speed); 129 page=0; 130 } 131 _this.find(".thumb span").removeClass("active").eq(page).addClass("active"); 132 if(_bauto){ 133 touchgo = setTimeout('autoTouch()', autotime); 134 } 135 } 136 if(_bauto){ 137 $(".banner .pic li").eq(0).find("img").load(function(){ 138 touchgo = setTimeout('autoTouch()', autotime); 139 }); 140 } 141 _this.find(".thumb span").click(function(){ 142 clearInterval(touchgo); 143 page = $(this).index(); 144 $(move).animate({ 145 left:-(page*_liw) 146 },speed); 147 _this.find(".thumb span").removeClass("active").eq(page).addClass("active"); 148 if(_bauto){ 149 touchgo = setTimeout('autoTouch()', autotime); 150 } 151 }); 152 $(window).resize(function(){ 153 if($(".banner .pic li").length>0){ 154 _liw = $(".banner .pic").width(); 155 _ulw = _len*_liw; 156 $(".banner .pic li").css("width",_liw); 157 _windowW = $(window).width(); 158 clearInterval(touchgo); 159 $(move).stop().css("left",-(page*_liw)); 160 if(_bauto){ 161 touchgo = setTimeout('autoTouch()', autotime); 162 } 163 } 164 }); 165 } 166});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.