1// 18.1.3çæ¬æ´æ° 2//头æ¡+bannerè½®æ+ä¸é¢èªå¨ææ¾ 3/* 4 * æææå±ç»ä»¶ï¼å¨å个页é¢å¼ç¨æ¶ï¼å ¶æé®ççéæ©å¨class ä¸è½ç¸åï¼å¦åå°ä¼å²çª 5 * 6 * */ 7(function ($) { 8 //ææ classå为jqueryéæ©å¨ 9 //忢 10 /* 11 * optionåæ°è¯´æï¼æ²¡æç¹æ®è¯´æç±»åå为string 12 * text:åæ¢ææ¬çclassï¼å¦ææ²¡æåä¸å¡«å 13 * prev 忢btn classï¼å¦ææ²¡æåä¸å¡«å 14 * next 忢btn class ï¼å¦ææ²¡æåä¸å¡«å 15 * num éè¿num忢ï¼å¦ææ²¡æåä¸å¡«åï¼numçlengthå¿ é¡»ä¸åæ¢å¯¹è±¡lengthç¸å 16 * className å½åéä¸numçclassName(䏿¯éæ©å¨)ï¼é»è®¤:cur 17 * callback ç±»åï¼function æ¯æ¬¡åæ¢å®æè°ç¨ï¼å¦ææ²¡æåä¸å¡«å 18 * index ç±»åï¼number 忢å¼å§ä½ç½® 19 * time ç±»å number åæ¢è¿æ¸¡æ¶é´ï¼é»è®¤ï¼300; 20 * autoPlay ç±»å boolean æ¯å¦è½®æ,é»è®¤:trueï¼ 21 * playTime ç±»å number èªå¨ææ¾æ¶é´ï¼é»è®¤:4000, 22 * direction èªå¨ææ¾çé¡ºåº é»è®¤ï¼next 23 * type 忢æ¹åtopæleft,é»è®¤ï¼left 24 * space ç±»åï¼number 忢itemä¸çé´è· é»è®¤ï¼0 25 * indy卿æ°ååå 26 * lendy æ»é¿åº¦ 27 * */ 28 function simpleSwitch(option) { 29 var $banner = option._this, 30 $text = option.text ? $(option.text) : null, 31 $prev = option.prev ? $(option.prev) : null, 32 $next = option.next ? $(option.next) : null, 33 $num = option.num ? $(option.num) : null, 34 $indy = option.indy ? $(option.indy) : null, 35 $lendy = option.lendy ? $(option.lendy) : null, 36 callBack = option.callback; 37 var len = $banner.length, 38 index = option.index || 0, 39 time = option.time || 300, 40 playTime = option.playTime || 4000, 41 type = option.type || "left", 42 direction = option.direction || "next", 43 autoPlay = 44 option.autoPlay === undefined || option.autoPlay === true 45 ? true 46 : false, 47 className = option.className || "cur"; 48 type = type === "top" ? "top" : "left"; 49 var pw = 50 type === "top" ? $banner.parent().height() : $banner.parent().width(), 51 cw = type === "top" ? $banner.height() : $banner.width(); 52 option.space = option.space || 0; 53 cw += option.space; 54 var css = {}; 55 if (cw * len <= pw) return; 56 init(); 57 function init() { 58 if ($lendy) { 59 $lendy.text(len); 60 } 61 $banner.each(function () { 62 var _i = $(this).index(); 63 $(this).show(); 64 css[type] = (_i - index) * cw; 65 $(this).css(css); 66 }); 67 if ($num) { 68 $num.eq(index).addClass(className).siblings().removeClass(className); 69 } 70 if ($indy) { 71 $indy.text(index + 1); 72 } 73 if ($text) { 74 $text.eq(index).show(0).siblings().hide(); 75 } 76 } 77 function nextMove() { 78 if (!$banner.is(":visible")) return; 79 for (var i = 0; i < len; i++) { 80 var $item = $banner.eq(i); 81 var pos = Math.floor($item.position()[type]); 82 if (pos <= -cw) { 83 var perLeft = 0; 84 if (i === 0) { 85 perLeft = $banner.eq(len - 1).position()[type]; 86 } else { 87 perLeft = $banner.eq(i - 1).position()[type]; 88 } 89 css[type] = perLeft + cw; 90 $item.css(css); 91 } 92 var nowLeft = $item.position()[type]; 93 css[type] = nowLeft - cw; 94 $item.animate(css, time); 95 } 96 } 97 function prevMove() { 98 if (!$banner.is(":visible")) return; 99 for (var i = 0; i < len; i++) { 100 var $item = $banner.eq(i); 101 var pos = Math.floor($item.position()[type]); 102 if (pos >= pw) { 103 var perLeft = 0; 104 if (i === len - 1) { 105 perLeft = $banner.eq(0).position()[type]; 106 } else { 107 perLeft = $banner.eq(i + 1).position()[type]; 108 } 109 css[type] = perLeft - cw; 110 $item.css(css); 111 } 112 var nowLeft = $item.position()[type]; 113 css[type] = nowLeft + cw; 114 $item.animate(css, time); 115 } 116 } 117 function bannerPlay() { 118 if ($banner.is(":animated")) return; 119 index++; 120 index = index >= len ? 0 : index; 121 if (direction === "next") { 122 nextMove(); 123 } else { 124 prevMove(); 125 } 126 toNextShow(); 127 } 128 if (autoPlay) { 129 var play = setInterval(bannerPlay, playTime); 130 } 131 function toNextShow() { 132 if ($num) { 133 if (direction === "next") { 134 $num.eq(index).addClass(className).siblings().removeClass(className); 135 } else { 136 $num 137 .eq(len - index) 138 .addClass(className) 139 .siblings() 140 .removeClass(className); 141 } 142 } 143 if ($text) { 144 if (direction === "next") { 145 $text.eq(index).show(0).siblings().hide(); 146 } else { 147 $text 148 .eq(len - index) 149 .show(0) 150 .siblings() 151 .hide(); 152 } 153 } 154 if ($indy) { 155 if (direction === "next") { 156 $indy.text(index + 1); 157 } else { 158 $indy.text(len - index + 1); 159 } 160 } 161 if (!autoPlay) return; 162 clearInterval(play);
163 play = null; 164 play = setInterval(bannerPlay, playTime); 165 if (callBack) callBack(); 166 } 167 if ($next) { 168 $next.click(function () { 169 if ($banner.is(":animated")) return; 170 index--; 171 index = index < 0 ? len - 1 : index; 172 // 12.10ä¿®æ¹ 173 prevMove(); 174 toNextShow(); 175 }); 176 } 177 if ($prev) { 178 $prev.click(function () { 179 if ($banner.is(":animated")) return; 180 index++; 181 index = index >= len ? 0 : index; 182 // 12.10ä¿®æ¹ 183 nextMove(); 184 toNextShow(); 185 }); 186 } 187 if ($num) { 188 $num.mouseenter(function () { 189 if ($banner.is(":animated")) return; 190 var nextIndex = $num.index($(this)); 191 $banner.each(function () { 192 var _i = $(this).index(); 193 $(this).show(); 194 css[type] = (_i - index) * cw; 195 $(this).css(css); 196 }); 197 for (var i = 0; i < len; i++) { 198 var $item = $banner.eq(i); 199 var nowLeft = $item.position()[type]; 200 css[type] = nowLeft + -cw * (nextIndex - index); 201 $item.animate(css, time); 202 } 203 index = nextIndex; 204 toNextShow(); 205 }); 206 } 207 } 208 209 // æ·¡å ¥æ·¡åºåæ¢ 210 /* 211 * åæ°é ç½®å¦ä¸ 212 * */ 213 function SwitchFade(option) { 214 var $banner = option._this, 215 $text = option.text ? $(option.text) : null, 216 $num = option.num ? $(option.num) : null, 217 $indy = option.indy ? $(option.indy) : null, 218 $lendy = option.lendy ? $(option.lendy) : null, 219 index = option.index || 0, 220 len = $banner.length, 221 time = option.time || 300, 222 playTime = option.playTime || 4000, 223 className = option.className || "cur"; 224 $banner.hide(); 225 $banner.eq(index).show(); 226 SwitchTransform(); 227 function SwitchTransform() { 228 $banner.stop().eq(index).fadeIn(time).siblings().fadeOut(time); 229 $num.eq(index).addClass(className).siblings().removeClass(className); 230 $text.eq(index).show().siblings().hide(); 231 if ($indy) { 232 $lendy.text(len); 233 $indy.text(index + 1); 234 } 235 } 236 function SwitchPlay() { 237 if ($banner.is(":animated")) return; 238 index++; 239 index = index >= len ? 0 : index; 240 SwitchTransform(); 241 } 242 var play = setInterval(SwitchPlay, playTime); 243 $num.hover( 244 function () { 245 clearInterval(play); 246 play = null; 247 index = $num.index($(this)); 248 SwitchTransform(); 249 }, 250 function () { 251 play = setInterval(SwitchPlay, playTime); 252 } 253 ); 254 if (option.prev) { 255 var $left = $(option.prev); 256 $left.click(function () { 257 index--; 258 index = index < 0 ? len - 1 : index; 259 SwitchTransform(); 260 clearInterval(play); 261 play = null; 262 play = setInterval(SwitchPlay, playTime); 263 }); 264 } 265 if (option.next) { 266 var $next = $(option.next); 267 $next.click(function () { 268 index++; 269 index = index >= len ? 0 : index; 270 SwitchTransform(); 271 clearInterval(play); 272 play = null; 273 play = setInterval(SwitchPlay, playTime); 274 }); 275 } 276 } 277 278 //æ»å¨ 279 /* 280 * option={ 281 * type: æ¹å topæ left é»è®¤ left 282 * spaceï¼é´è· é»è®¤ 15ï¼å¯ä»¥æ¯è´æ°ï¼æå¥½è®¾ç½®ä¸ä¸ï¼ 283 * nextãprevå·¦å³åæ¢æé® 284 * direction prevæè next é»è®¤ nextï¼å°±æ¯è®¾ç½®å¼å§çæ¶åæ¯åå·¦æè åå³ 285 * time æ»å¨æ¶é´ é»è®¤25,æ¶é´è¶å¤§æ»å¨è¶æ ¢ 286 * 287 * } 288 * */ 289 function simpleRoll(option) { 290 function RollNext() { 291 // console.log(Width) 292 for (var i = 0; i < len; i++) { 293 var $item = $photo.eq(i); 294 if ($item.position()[type] <= -Width) { 295 var perLeft = 0; 296 if (i === 0) { 297 perLeft = $photo.eq(len - 1).position()[type]; 298 } else { 299 perLeft = $photo.eq(i - 1).position()[type]; 300 } 301 var _css = {}; 302 if (type === "left") { 303 _css[type] = perLeft + cw; 304 } else { 305 _css[type] = perLeft + Width; 306 } 307 $item.css(_css); 308 } 309 var nowLeft = $item.position()[type]; 310 (function ($item, nowLeft) { 311 setTimeout(function () { 312 var _css = {}; 313 _css[type] = nowLeft - 1; 314 $item.css(_css); 315 }, 5);
316 })($item, nowLeft); 317 } 318 } 319 function RollPrev() { 320 for (var i = 0; i < len; i++) { 321 var $item = $photo.eq(i); 322 // console.log(Width) 323 if ($item.position()[type] >= Width) { 324 var perLeft = 0; 325 if (i === len - 1) { 326 perLeft = $photo.eq(0).position()[type]; 327 } else { 328 perLeft = $photo.eq(i + 1).position()[type]; 329 } 330 var _css = {}; 331 if (type === "left") { 332 _css[type] = perLeft - cw; 333 } else { 334 _css[type] = perLeft - Width; 335 } 336 $item.css(_css); 337 } 338 // 12.13ä¿®æ¹ 339 var nowLeft = $item.position()[type]; 340 (function ($item, nowLeft) { 341 setTimeout(function () { 342 var _css = {}; 343 _css[type] = nowLeft + 1; 344 $item.css(_css); 345 }, 5); 346 })($item, nowLeft); 347 } 348 } 349 function playtmFun() { 350 play = setInterval(playFun, time); 351 } 352 var $photo = option._this, 353 direction = option.direction || "next", 354 $next = option.next ? $(option.next) : null, 355 $prev = option.prev ? $(option.prev) : null, 356 $parent = $photo.parent(), 357 len = $photo.length, 358 space = option.space || 15, 359 cw = $photo.width() + space, 360 play = null, 361 playFun = null, 362 time = option.time || 25, 363 type = option.type === "top" ? "top" : "left"; 364 // $photo.height()注æè¿ä¸ªæ¯$parent.height()è¿æ¯ä¸é¢è¿ä¸ª 365 var Width = type === "top" ? $photo.height() : $parent.width(); 366 $photo.each(function () { 367 var index = $(this).index(); 368 var _css = {}; 369 if (type === "left") { 370 _css[type] = index * cw; 371 } else { 372 _css[type] = index * Width; 373 } 374 $(this).css(_css); 375 }); 376 if (cw * len <= Width) return $photo; 377 if (direction === "next") { 378 playFun = RollNext; 379 } else { 380 playFun = RollPrev; 381 } 382 // 12.13ä¿®æ¹ 383 playtmFun(); 384 if ($prev) { 385 $prev.click(function () { 386 clearInterval(play); 387 playFun = RollNext; 388 playtmFun(); 389 }); 390 } 391 if ($next) { 392 $next.click(function () { 393 clearInterval(play); 394 playFun = RollPrev; 395 playtmFun(); 396 }); 397 } 398 $photo.hover( 399 function () { 400 clearInterval(play); 401 play = null; 402 }, 403 function () { 404 play = setInterval(playFun, time); 405 } 406 ); 407 } 408 //æ»å¨2 409 /* 410 * option={ 411 * type: æ¹å topæ left é»è®¤ left 412 * spaceï¼é´è· é»è®¤ 15ï¼æå¥½è®¾ç½®ä¸ä¸ï¼ 413 * nextãprevå·¦å³åæ¢æé® 414 * direction prevæè next é»è®¤ nextï¼å°±æ¯è®¾ç½®å¼å§çæ¶åæ¯åå·¦æè åå³ 415 * time æ»å¨æ¶é´ é»è®¤25,æ¶é´è¶å¤§æ»å¨è¶æ ¢ 416 * 417 * } 418 * */ 419 function rollImages(option) { 420 var $photo = option._this, 421 direction = option.direction || "next", 422 $next = option.next ? $(option.next) : null, 423 $prev = option.prev ? $(option.prev) : null, 424 $parent = $photo.parent(), 425 len = $photo.children().length, 426 space = option.space || 15, 427 cw = $photo.children().eq(0).width() + space, 428 play = null, 429 playFun = null, 430 time = option.time || 25, 431 type = option.type === "top" ? "top" : "left", 432 $child = $photo.children(); 433 console.log(option); 434 var Width = type === "top" ? $child.height() : $photo.children().width(); 435 $child.each(function () { 436 var index = $(this).index(); 437 $photo 438 .css({ position: "relative" }) 439 .children() 440 .css({ position: "absolute" }); 441 var _css = {}; 442 if (type === "left") { 443 _css[type] = index * cw; 444 } else { 445 Width = 35; 446 _css[type] = index * Width; 447 } 448 $(this).css(_css); 449 }); 450 if ($prev) { 451 $prev.click(function () { 452 clearInterval(play); 453 playFun = prevRoll; 454 playtmFun(); 455 }); 456 } 457 if ($next) { 458 $next.click(function () { 459 clearInterval(play);
460 playFun = nextRoll; 461 playtmFun(); 462 }); 463 } 464 $child.hover( 465 function () { 466 clearInterval(play); 467 play = null; 468 }, 469 function () { 470 play = setInterval(playFun, time); 471 } 472 ); 473 function playtmFun() { 474 play = setInterval(playFun, time); 475 } 476 if (direction === "next") { 477 playFun = prevRoll; 478 } else { 479 playFun = nextRoll; 480 } 481 playtmFun(); 482 function prevRoll() { 483 for (var i = 0; i < len; i++) { 484 var $item = $child.eq(i); 485 if ($item.position()[type] <= -Width) { 486 var perLeft = 0; 487 if (i === 0) { 488 perLeft = $child.eq(len - 1).position()[type]; 489 } else { 490 perLeft = $child.eq(i - 1).position()[type]; 491 } 492 var _css = {}; 493 if (type === "left") { 494 _css[type] = perLeft + cw; 495 } else { 496 _css[type] = perLeft + Width; 497 } 498 $item.css(_css); 499 } 500 var nowLeft = $item.position()[type]; 501 (function ($item, nowLeft) { 502 setTimeout(function () { 503 var _css = {}; 504 _css[type] = nowLeft - 1; 505 $item.css(_css); 506 }, 5); 507 })($item, nowLeft); 508 } 509 } 510 function nextRoll() { 511 for (var i = 0; i < len; i++) { 512 var $item = $child.eq(i); 513 if ($item.position()[type] >= cw * (len - 1)) { 514 var perLeft = 0; 515 if (i === len - 1) { 516 perLeft = $child.eq(0).position()[type]; 517 } else { 518 perLeft = $child.eq(i + 1).position()[type]; 519 } 520 var _css = {}; 521 if (type === "left") { 522 _css[type] = perLeft - cw; 523 } else { 524 _css[type] = perLeft - Width; 525 } 526 $item.css(_css); 527 } 528 // 12.13ä¿®æ¹ 529 var nowLeft = $item.position()[type]; 530 (function ($item, nowLeft) { 531 setTimeout(function () { 532 var _css = {}; 533 _css[type] = nowLeft + 1; 534 $item.css(_css); 535 }, 5); 536 })($item, nowLeft); 537 } 538 } 539 } 540 //å¤å¼ å¾ç左峿»å¨ï¼æ¯æ¬¡åªæ»å¨ä¸å¼ ï¼ 541 /* 542 * option={ 543 * len æ¾ç¤ºå ä¸ªçæ°é 544 * type: æ¹å right æ left é»è®¤ left 545 * spaceï¼é´è· é»è®¤ 15 546 * prev next å·¦å³æé® 547 * parentBox ç¶å®¹å¨å ç´ 548 * childBox åå ç´ 549 * childMargin åå ç´ å¤è¾¹è·ï¼æ²¡æå¯ä¸ä¼ 550 * 551 aniTime:é»è®¤500,//è¿æ¸¡æ¶é´ 552 moveTime:é»è®¤3000//é´éæ»å¨æ¶é´ 553 fun: æ»å¨åè° 554 * 555 * 556 * } 557 * */ 558 function bannerRollLR(option) { 559 var len = option.len || banBox.children().length, //æ¾ç¤ºå ä¸ªçæ°é 560 aniTime = option.aniTime || 500, //è¿æ¸¡æ¶é´ 561 moveTime = option.moveTime || 3000, //é´éæ»å¨æ¶é´ 562 banBox = option._this, //ç§»å¨çå®¹å¨ 563 type = option.type || "left", 564 banBtnL = option.prev ? $(option.prev) : null, //å·¦æé® 565 banBtnR = option.next ? $(option.next) : null; //å³æé® 566 // banBtnL.show(); 567 // banBtnR.show(); 568 var i = 0, 569 cloneArr = []; 570 // moveM = (banBox.parent().width())/len; 571 banBox.each(function () { 572 for (var i = 0; i < len; i++) { 573 cloneArr.push(banBox.children().eq(i).clone()); 574 } 575 }); 576 for (var j = 0; j < cloneArr.length; j++) { 577 banBox.append(cloneArr[j]); 578 } 579 var sizeChild = banBox.children().length; 580 var moveM = banBox.children().outerWidth(true); //è·åå å¤è¾¹è· 581 banBox.css({ width: sizeChild * moveM * 1.2 }); 582 function movel() { 583 if (banBox.is(":animated")) return; 584 i++; 585 if (i === sizeChild - (len - 1)) { 586 banBox.css({ left: 0 }); 587 i = 1; 588 } 589 banBox.stop().animate({ left: -i * moveM }, aniTime, function () { 590 changeLStyle( 591 option.parentBox, 592 option.childBox, 593 option.len, 594 option.childMargin 595 ); 596 }); 597 } 598 function mover() { 599 if (banBox.is(":animated")) return; 600 i--; 601 if (i === -1) { 602 banBox.css({ left: -(sizeChild - len) * moveM }); 603 i = sizeChild - (len + 1); 604 } 605 banBox.stop().animate({ left: -i * moveM }, aniTime, function () { 606 changeRStyle(option.parentBox, option.childBox, option.len); 607 }); 608 } 609 /** 610 * å¾å³èµ°çæ ·å¼ 611 */ 612 var tabStatus = true, 613 Lstautus = false; 614 function changeRStyle(parentBox, childBox, Num) { 615 var CurDom = $(parentBox).find(".cur"); 616 var leftLen = parseFloat($(parentBox).css("left")); 617 if (tabStatus) { 618 var listNums = $(parentBox).children("li").length; 619 $(childBox).removeClass("cur"); 620 $(childBox) 621 .eq(listNums - Num + 1) 622 .addClass("cur"); 623 tabStatus = false; 624 return; 625 } 626 if (leftLen == 0) { 627 tabStatus = true; 628 } 629 CurDom.prev().addClass("cur").next().removeClass("cur"); 630 } 631 632 /** 633 * å¾å·¦èµ°çæ ·å¼ 634 */ 635 function changeLStyle(parentBox, childBox, Num, childMargin) { 636 var CurDom = $(parentBox).find(".cur"); 637 var leftLen = parseFloat($(parentBox).css("left")); 638 if (!childMargin) { 639 childMargin = 0; 640 } 641 var liWidth = parseFloat($(childBox).width()) + childMargin; //30æ¯margin 642 if (tabStatus) { 643 $(childBox).removeClass("cur"); 644 if (Lstautus) { 645 $(childBox) 646 .eq(Num - 1) 647 .addClass("cur"); 648 } else { 649 $(childBox) 650 .eq(Num - 2) 651 .addClass("cur"); 652 } 653 tabStatus = false; 654 Lstautus = false; 655 return; 656 } 657 if (leftLen == -liWidth) { 658 tabStatus = true; 659 Lstautus = true; 660 $(childBox).removeClass("cur"); 661 $(childBox) 662 .eq(Num - 2) 663 .addClass("cur"); 664 return; 665 } 666 CurDom.next().addClass("cur").prev().removeClass("cur"); 667 } 668 // å·¦æé® 669 // æ·»å ä¸ä¸ªåé12.10 670 var tmr; 671 var tml; 672 var t; 673 var bj; 674 if (type === "left") { 675 bj = false; 676 } else { 677 bj = true; 678 } 679 if (banBtnL) { 680 banBtnL.click(function () { 681 clearInterval(t); 682 clearInterval(tmr); 683 clearInterval(tml); 684 movel(); 685 tml = setInterval(movel, moveTime); 686 bj = false; 687 }); 688 } 689 // å³æé® 690 if (banBtnR) { 691 banBtnR.click(function () { 692 clearInterval(t); 693 clearInterval(tml); 694 clearInterval(tmr); 695 mover(); 696 tmr = setInterval(mover, moveTime); 697 bj = true; 698 }); 699 } 700 // 宿¶å¨ 701 if (type === "left") { 702 t = setInterval(movel, moveTime); 703 } else { 704 t = setInterval(mover, moveTime); 705 } 706 // 对banner宿¶å¨çæä½ 707 banBox.parent().hover( 708 function () { 709 clearInterval(t); 710 clearInterval(tml); 711 clearInterval(tmr); 712 }, 713 function () { 714 if (bj === false) { 715 t = setInterval(movel, moveTime); 716 } else { 717 t = setInterval(mover, moveTime); 718 } 719 } 720 ); 721 } 722 723 /* 724 * tab忢 725 *jQuery(".news-tab-header li").tabPanelFun({ 726 cur:'cur', é¼ æ ç»è¿é项添å çç±» 727 tabContent:'.news-tab-lists', tab忢å 容çæå¤å±å®¹å¨ï¼æ¯news-tab-headerçå å¼å ç´ 728 tabItem:'.news-tab-item' tab忢å 容éçåå ç´ ï¼å³è¦åæ¢å å®¹ï¼ 729 praï¼é»è®¤falseï¼å¦ætabçé项æé®æ¯å¤å±æ¬¡çå°±éture 730 pradom æ·±å±æ¬¡çæç¶çº§å ç´
731 evnets ç¹å»äºä»¶æè å ¶ä»äºä»¶evnets:'click'ï¼é»è®¤mouseenter 732 }) 733 * 734 * 735 */ 736 function tabPanelFun(option) { 737 var $panel = option._this, 738 cur = option.cur ? option.cur : null, 739 pra = option.pra ? option.pra : false, 740 pradom = option.pradom ? option.pradom : null, 741 tabContent = option.tabContent ? option.tabContent : null, 742 tabItem = option.tabItem ? option.tabItem : null, 743 ev = option.evnets ? option.evnets : "mouseenter"; 744 var tabItemdu = $(tabContent).find(tabItem); 745 $panel.eq(0).addClass(cur); 746 //$(tabItemdu).hide(); 747 //$(tabItemdu).eq(0).show(); 748 $panel.on(ev, function () { 749 var index = $(this).parent().children($panel.selector).index(this); 750 if (pra === true) { 751 jQuery(this) 752 .parents(pradom) 753 .siblings(tabContent) 754 .children(tabItemdu) 755 .eq(index) 756 .show() 757 .siblings() 758 .hide(); 759 } else { 760 jQuery(this) 761 .parent() 762 .siblings(tabContent) 763 .children(tabItemdu) 764 .eq(index) 765 .show() 766 .siblings() 767 .hide(); 768 } 769 jQuery(this).addClass(cur).siblings($panel.selector).removeClass(cur); 770 }); 771 } 772 /** 773 * [dropDownFun description] 774 * tagSiblings:.drop-down .tagçå å¼å ç´ 775 * optionItemï¼ä¸æåé项 776 * optionBool:æ¯å¦æ¯è·åå½åå ç´ çå¼ç».tagå ç´ ï¼é»è®¤æ¯fasleï¼é»è®¤ï¼å½åå ç´ ï¼trueæ¯åå ç´ 777 * cur:å½åæ·»å çæ ·å¼,ä¸ä¼ éé»è®¤ä¸ºç©º 778 * @return {[type]} [description] 779 */ 780 function dropDownFun(option) { 781 var $label = option._this, 782 cur = option.cur ? option.cur : "", 783 $tagSiblings = option.tagSiblings, 784 $optionBool = option.optionBool ? option.optionBool : false, 785 $optionItem = option.optionItem; 786 $label.each(function () { 787 $(this).on("click", function (e) { 788 var ev = e || window.event; 789 if (ev.stopPropagation) { 790 ev.stopPropagation(); 791 } else { 792 ev.cancelBubble = true; 793 } 794 var index = $label.index($(this)); 795 $(this).stop().toggleClass(cur).siblings($tagSiblings).slideToggle(); 796 for (var i = 0, max = $label.length; i < max; i++) { 797 if (index !== i) 798 $label 799 .eq(i) 800 .stop() 801 .removeClass(cur) 802 .siblings($tagSiblings) 803 .slideUp(); 804 } 805 }); 806 }); 807 $(document).on("click", $optionItem, function () { 808 // æ³¨ææ¯è·åå½åå ç´ è¿æ¯åå ç´ 809 var text = 810 $optionBool === false ? $(this).children().text() : $(this).text(); 811 $(this).parents($tagSiblings).siblings($label).text(text); 812 }); 813 $(document).on("click", function () { 814 $label.stop().removeClass(cur).siblings($tagSiblings).slideUp(); 815 }); 816 } 817 // å¤è¡æåè¶ åºç¨çç¥å·æ¾ç¤º 818 function overEllipsis(option) { 819 var $list = option._this, 820 maxCount = option.maxCount; 821 $list.each(function (index, item) { 822 var itemString = $(item).text(); 823 if (itemString.length > maxCount) { 824 $(item).html(itemString.substring(0, maxCount) + "..."); 825 } 826 }); 827 } 828 //echartåå§å 829 function initEchart(option) { 830 var $id = option._this, 831 toption = option.echartoption; 832 var myChart = echarts.init($id[0]); 833 myChart.setOption(toption); 834 } 835 //å°¾é¨ä¸æ 836 function dropDownImgText(option) { 837 var tag = option.tag, 838 cont = option._this, 839 text = option.text, 840 arrow = option.arrow, 841 drop = option.drop, 842 label = option.label, 843 event = option.event || "click", 844 cur = option.cur || "cur"; 845 $(cont).each(function (index, item) { 846 $(item) 847 .children(tag) 848 .on(event, function (e) { 849 e = e || event; 850 e.stopPropagation(); 851 var _thi = $(this); 852 $(this).parent().siblings(cont).children(drop).slideUp(); 853 $(this) 854 .parent() 855 .siblings(cont) 856 .children(tag) 857 .children() 858 .children(arrow) 859 .removeClass(cur); 860 $(document).on(event, function () { 861 _thi.siblings().slideUp(); 862 _thi.children().children(arrow).removeClass(cur); 863 }); 864 if ($(this).siblings().css("display") === "block") { 865 $(this).children().children(arrow).removeClass(cur); 866 $(this).siblings().slideUp(); 867 return; 868 } else { 869 $(this).children().children(arrow).addClass(cur); 870 $(this).siblings().slideDown(); 871 $(this) 872 .siblings() 873 .find(label) 874 .on(event, function (e) { 875 e = e || event; 876 _thi.children().children(arrow).removeClass(cur); 877 _thi.children(text).text($(this).text()); 878 _thi.siblings().slideUp(); 879 e.stopPropagation(); 880 }); 881 return; 882 } 883 }); 884 });
885 } 886 //tab忢 887 function tabSwitch(option) { 888 var items = $(option._this), 889 event = option.event || "mouseover", 890 cur = option.cur || "cur", 891 tabHead = option.tabHead, 892 tabCont = option.tabCont; 893 items.each(function (index, item) { 894 var btns = $(item).find(tabHead); 895 var cons = $(item).find(tabCont); 896 $(btns).eq(0).addClass(cur); 897 $(cons).hide(); 898 $(cons).eq(0).show(); 899 $(btns).on(event, function () { 900 $(this).addClass(cur).siblings().removeClass(cur); 901 $(cons).eq($(btns).index(this)).show().siblings().hide(); 902 }); 903 }); 904 } 905 /* 906 *èå¨å¾çææ¾ 907 *大å¾å¾çæ°éåå¾çå表çå¾çæ°éè¦ä¸è´ 908 *optionåæ°è¯´æï¼æ²¡æç¹æ®è¯´æç±»åå为string 909 *prev: 大å¾çååææ¾æé®, 910 *next: 大å¾çååææ¾æé®, 911 *ptNext: å¾çå表ååææ¾æé®, 912 *ptPrev: å¾çå表ååææ¾æé®, 913 *banner: 大徿æ¾é¡¹, 914 *text: 大徿å项, 915 *link: å°å¾å表项, 916 *linkSpace: ç±»å number å°å¾ä¹é´çé´è·, é»è®¤0 917 *linkType: å°å¾ç§»å¨çæ¹åï¼é»è®¤: top 918 *type: 大å¾åæ¢æ¹åtopæleft,é»è®¤ï¼left 919 *autoPlay ç±»å boolean æ¯å¦è½®æ,é»è®¤:true; 920 *playTime ç±»å number èªå¨ææ¾æ¶é´ï¼é»è®¤:4000; 921 *direction 大å¾èªå¨ææ¾çé¡ºåº é»è®¤ï¼next; 922 *time ç±»å number åæ¢è¿æ¸¡æ¶é´ï¼é»è®¤ï¼300; 923 *cur å°å¾çææç±»åï¼ é»è®¤: 'cur' 924 */ 925 function linkSwitch(option) { 926 var $banner = option._this ? $(option._this) : null, 927 $link = option.link ? $(option.link) : null, 928 $text = option.text ? $(option.text) : null; 929 var playTime = option.playTime || 4000, 930 linkSpace = option.linkSpace || 0, 931 direction = option.direction || "next", 932 linkType = option.linkType || "top", 933 type = option.type ? option.type : "left", 934 autoPlay = option.autoPlay ? option.autoPlay : true, 935 time = option.time || 300, 936 cur = option.cur || "cur"; 937 var unit = 938 type === "top" ? $banner.parent().height() : $banner.parent().width(), 939 match = 940 linkType === "top" 941 ? $link.height() + linkSpace 942 : $link.width() + linkSpace, 943 len = $banner ? $banner.length : 0, 944 index = 0, 945 css = {}, 946 cssLink = {}; 947 948 init(); 949 950 if (autoPlay) { 951 var play = setInterval(bannerPlay, playTime); 952 $banner.hover( 953 function () { 954 clearInterval(play); 955 play = null; 956 }, 957 function () { 958 play = setInterval(bannerPlay, playTime); 959 } 960 ); 961 } 962 963 if ($link) { 964 $link.click(function () { 965 if ($banner.is(":animated")) return; 966 if ($link.is(":animated")) return; 967 index = $(this).index(); 968 configShow(); 969 index = index < 0 ? len - 1 : index; 970 $(this).addClass(cur).siblings().removeClass(cur); 971 move(); 972 }); 973 } 974 975 function init() { 976 $banner.eq(index).show().siblings().hide(); 977 $link.each(function () { 978 var _i = $(this).index(); 979 $(this).show(); 980 cssLink[linkType] = (_i - index) * match; 981 $(this).css(cssLink); 982 }); 983 configShow(); 984 } 985 986 function bannerPlay() { 987 if ($banner.is(":animated")) return; 988 index++; 989 index = index >= len ? 0 : index; 990 move(); 991 configShow(); 992 linkPlay(); 993 } 994 995 function move() { 996 $banner.eq(index).fadeIn(time).siblings().fadeOut(time); 997 } 998 999 function linkPlay() { 1000 for (var i = 0; i < len; i++) { 1001 var $item = $link.eq(i); 1002 var type = linkType; 1003 if ($item.position()[type] <= -match) { 1004 var perLeft = 0; 1005 if (i === 0) { 1006 perLeft = $link.eq(len - 1).position()[type]; 1007 } else { 1008 perLeft = $link.eq(i - 1).position()[type]; 1009 } 1010 cssLink[type] = perLeft + match; 1011 $item.css(cssLink); 1012 } 1013 var nowLeft = $item.position()[type]; 1014 cssLink[type] = nowLeft - match; 1015 $item.animate(cssLink, time); 1016 } 1017 } 1018 1019 function configShow() { 1020 if ($text) { 1021 $text.eq(index).show().siblings().hide(); 1022 } 1023 $link.eq(index).addClass(cur).siblings().removeClass(cur); 1024 } 1025 } 1026 /**** 1027 * åå°é¡¶é¨ 1028 */ 1029 function goBack(option) { 1030 var $banner = option._this ? $(option._this) : null; 1031 $banner.click(function () { 1032 $("html,body").animate({ scrollTop: 0 }, 500); 1033 });
1034 $(window).scroll(function () { 1035 var gun = $(document).scrollTop(); 1036 if (gun <= 400) { 1037 if (option.isShow) { 1038 $banner.hide(); 1039 } 1040 } else { 1041 $banner.show(); 1042 } 1043 }); 1044 } 1045 /**** 1046 * 左峿µ®å¨ï¼å¹¿åå¼¹çªï¼ 1047 * direction(left right)å¿ å¡« 1048 */ 1049 function floatLR(option) { 1050 var $banner = option._this ? $(option._this) : null, 1051 direction = option.direction; 1052 var margin_dis = 1053 (parseInt($(document.body).width()) - 1200) / 2 + 1200 + 30 + "px"; 1054 $banner.css(direction, margin_dis); 1055 $(window).resize(function () { 1056 if (parseInt($(window).width()) < 1480) { 1057 margin_dis = parseInt($(window).width()) - 100 + "px"; 1058 } else { 1059 margin_dis = 1060 (parseInt($(document.body).width()) - 1200) / 2 + 1200 + 30 + "px"; 1061 } 1062 $banner.css(direction, margin_dis); 1063 }); 1064 } 1065 1066 $.fn.extend({ 1067 SwitchFade: function (option) { 1068 var opt = option || {}; 1069 opt._this = $(this); 1070 SwitchFade(opt); 1071 }, 1072 simpleSwitch: function (option) { 1073 var opt = option || {}; 1074 opt._this = $(this); 1075 simpleSwitch(opt); 1076 }, 1077 simpleRoll: function (optioin) { 1078 var option = optioin || {}; 1079 option._this = $(this); 1080 simpleRoll(option); 1081 }, 1082 rollImages: function (optioin) { 1083 var option = optioin || {}; 1084 option._this = $(this); 1085 rollImages(option); 1086 }, 1087 bannerRollLR: function (optioin) { 1088 var option = optioin || {}; 1089 option._this = $(this); 1090 bannerRollLR(option); 1091 }, 1092 tabPanelFun: function (optioin) { 1093 var option = optioin || {}; 1094 option._this = $(this); 1095 tabPanelFun(option); 1096 }, 1097 dropDownFun: function (optioin) { 1098 var option = optioin || {}; 1099 option._this = $(this); 1100 dropDownFun(option); 1101 }, 1102 overEllipsis: function (optioin) { 1103 var option = optioin || {}; 1104 option._this = $(this); 1105 overEllipsis(option); 1106 }, 1107 initEchart: function (optioin) { 1108 var option = optioin || {}; 1109 option._this = $(this); 1110 initEchart(option); 1111 }, 1112 dropDownImgText: function (optioin) { 1113 var option = optioin || {}; 1114 option._this = $(this); 1115 dropDownImgText(option); 1116 }, 1117 tabSwitch: function (optioin) { 1118 var option = optioin || {}; 1119 option._this = $(this); 1120 tabSwitch(option); 1121 }, 1122 linkSwitch: function (optioin) { 1123 var option = optioin || {}; 1124 option._this = $(this); 1125 linkSwitch(option); 1126 }, 1127 goBack: function (optioin) { 1128 var option = optioin || {}; 1129 option._this = $(this); 1130 goBack(option); 1131 }, 1132 floatLR: function (optioin) { 1133 var option = optioin || {}; 1134 option._this = $(this); 1135 floatLR(option); 1136 }, 1137 rowsCentered: function (optioin) { 1138 var option = optioin || {}; 1139 option._this = $(this); 1140 rowsCentered(option); 1141 }, 1142 swiperInit: function (optioin) { 1143 var option = optioin || {}; 1144 option._this = $(this); 1145 swiperInit(option); 1146 }, 1147 boxReSizeToWap: function (optioin) { 1148 var option = optioin || {}; 1149 option._this = $(this); 1150 boxReSizeToWap(option); 1151 }, 1152 swiperTo: function (index) { 1153 swiperTo(index); 1154 }, 1155 }); 1156})(jQuery); 1157 1158if (typeof exports === "object") { 1159 module.exports = jQuery; 1160} 1161 1162/** 1163 * å¤è¡ææ¬ç«ç´æ¹åå± ä¸ 1164 * @param options 1165 */ 1166function rowsCentered(options) { 1167 var items = $(options._this); 1168 items.each(function () { 1169 var _this = $(this); 1170 _this.css({ 1171 position: "absolute", 1172 top: "50%", 1173 marginTop: -_this.height() / 2 1174 }); 1175 _this.parent().css({ position: "relative" }); 1176 }); 1177} 1178 1179/** 1180 * å ¬å ±è½®æç»ä»¶ 1181 * @param SwiperNums number //swiper被è°ç¨ç次æ°ç±»å 1182 * @param swiperObject object //swiperçææå®ä¾ 1183 * @param optionsåæ°è¯´æï¼ 1184 * @param type number //swiperç±»å 1, 2, 3, 4 1185 * @param loop boolean //æ¯å¦å¾ªç¯è½®æ 1186 * @param spped number //è½®ææ»å¨é度 1187 * @param grabCursor boolean //æ¯å¦æ¯æææ» 1188 * @param paginationClickable boolean //æ¯å¦å¯ä»¥ç¹å»å页忢 1189 * @param calculateHeight boolean //æ¯å¦æ ¹æ®å 容èªå¨è®¡ç®é«åº¦ 1190 * @param autoplayDisableOnInteraction boolean //æ¯å¦æå¨åæ¢ä¹åæåè½®æ 1191 * @param slidesPerView number //å±å¹æ¾ç¤ºççåä¸ªæ° 1192 * @param slidesPerGroup number //è½®ææ¯æ¬¡æ»å¨ççåä¸ªæ° 1193 * @param slidesPerViewByWap number //h5è½®æå±å¹æ¾ç¤ºççåä¸ªæ° 1194 * @param slidesPerGroupByWap number //h5è½®ææ¯æ¬¡æ»å¨ççåä¸ªæ° 1195 * @param tdFlow boolean //æ¯å¦å±ç¤º3dææ 1196 * @param btnAside boolean //æ¯å¦éè¦æ·»å æé®é è¾¹æ ·å¼ 1197 * 1198 */ 1199var SwiperNums = 0, 1200 swiperObject = {}; 1201function swiperInit(options) { 1202 var items = $(options._this); 1203 SwiperNums++; 1204 var swiper = "swiper_" + SwiperNums; 1205 options.swiper = swiper; 1206 switch (options.type) { 1207 case 1: 1208 swiper1(options, items); 1209 break; 1210 case 2: 1211 swiper2(options, items); 1212 break; 1213 case 3: 1214 swiper3(options, items); 1215 break; 1216 case 4: 1217 swiper4(options, items); 1218 break; 1219 default: 1220 swiper1(options, items); 1221 } 1222} 1223function swiperTo(index) { 1224 console.log(index) 1225 swiperObject[index].swipePrev(); 1226} 1227 1228/** 1229 * 第ä¸ç§è½®æï¼åªæ¾ç¤ºä¸å¼ å¾åæåï¼å¾ªç¯è½®æ 1230 * @param options 1231 * @param _this 1232 */ 1233function swiper1(options, _this) { 1234 var swiper = options.swiper, 1235 swiperPagination; 1236 _this.attr("id", swiper).addClass("SWIPER-1"); 1237 if ($("#" + swiper + " .pagination").length == 0) { 1238 swiperPagination = ""; 1239 } else { 1240 swiperPagination = "#" + swiper + " .pagination"; 1241 } 1242 swiperObject[swiper] = new Swiper("#" + swiper + " .swiper-container", { 1243 pagination: swiperPagination, 1244 loop: options.loop != undefined ? options.loop : true, 1245 speed: options.speed != undefined ? options.speed : 500, 1246 autoplay: options.autoplay != undefined ? options.autoplay : 3000, 1247 grabCursor: options.grabCursor != undefined ? options.grabCursor : false, 1248 paginationClickable: 1249 options.paginationClickable != undefined 1250 ? options.paginationClickable 1251 : true, 1252 autoplayDisableOnInteraction: false 1253 }); 1254 _this.find(".arrow-left").on("click", function (e) { 1255 e.preventDefault(); 1256 swiperObject[swiper].swipePrev(); 1257 }); 1258 _this.find(".arrow-right").on("click", function (e) { 1259 e.preventDefault(); 1260 swiperObject[swiper].swipeNext(); 1261 }); 1262} 1263 1264/** 1265 * 第ä¸ç§è½®æï¼å¤ä¸ªçåè¿ç»æ»å¨åæ¢ï¼é»è®¤åæ¢ä¸æ´å±å 容ï¼å¾ªç¯è½®æ 1266 * @param options 1267 * @param _this 1268 */ 1269function swiper2(options, _this) { 1270 var swiper = options.swiper, 1271 swiperPagination; 1272 var slidesPerView = options.slidesPerView; 1273 var slidesPerGroup = options.slidesPerGroup; 1274 _this.attr("id", swiper).addClass("SWIPER-2"); 1275 if ($(window).width() < 768) { 1276 $("#" + swiper) 1277 .parent() 1278 .css({ width: "100%" });
1279 slidesPerView = 1280 options.slidesPerViewByWap != undefined ? options.slidesPerViewByWap : 1; 1281 slidesPerGroup = 1282 options.slidesPerGroupByWap != undefined 1283 ? options.slidesPerGroupByWap 1284 : 1; 1285 options.tdFlow = ""; 1286 } else if ($(window).width() >= 768 && $(window).width() < 1200) { 1287 // ipad 1288 slidesPerView = 3; 1289 slidesPerGroup = 1290 options.slidesPerGroup != undefined ? options.slidesPerGroup : 3; 1291 } else { 1292 slidesPerView = 1293 options.slidesPerView != undefined ? options.slidesPerView : 4; 1294 slidesPerGroup = 1295 options.slidesPerGroup != undefined ? options.slidesPerGroup : 1; 1296 } 1297 if ($("#" + swiper + " .pagination").length == 0) { 1298 swiperPagination = ""; 1299 } else { 1300 swiperPagination = "#" + swiper + " .pagination"; 1301 } 1302 swiperObject[swiper] = new Swiper("#" + swiper + " .swiper-container", { 1303 pagination: swiperPagination, 1304 loop: options.loop != undefined ? options.loop : true, 1305 speed: options.speed != undefined ? options.speed : 500, 1306 autoplay: options.autoplay != undefined ? options.autoplay : 3000, 1307 grabCursor: options.grabCursor != undefined ? options.grabCursor : false, 1308 calculateHeight: true, 1309 paginationClickable: true, 1310 slidesPerView: slidesPerView, 1311 slidesPerGroup: slidesPerGroup, 1312 centerInsufficientSlides: true, 1313 autoplayDisableOnInteraction: false, 1314 tdFlow: options.tdFlow != undefined ? options.tdFlow : "", 1315 touchRatio: 0.5 1316 }); 1317 $(window).resize(function () { 1318 swiperResize(swiperObject[swiper]); 1319 }); 1320 function swiperResize(mySwiper2) { 1321 var width = $(window).width(); 1322 if (width >= 768 && width < 1200) { 1323 // ipad 1324 slidesPerView = 3; 1325 slidesPerGroup = 1326 mySwiper2.params.slidesPerGroup != undefined 1327 ? mySwiper2.params.slidesPerGroup 1328 : 3; 1329 } else if (width >= 1200) { 1330 // pc 1331 slidesPerView = 1332 mySwiper2.params.slidesPerView != undefined 1333 ? mySwiper2.params.slidesPerView 1334 : 4; 1335 slidesPerGroup = 1336 mySwiper2.params.slidesPerGroup != undefined 1337 ? mySwiper2.params.slidesPerGroup 1338 : 1; 1339 } else { 1340 //wap 1341 $("#" + swiper) 1342 .parent() 1343 .css({ width: "100%" }); 1344 slidesPerView = 1345 mySwiper2.params.slidesPerViewByWap != undefined 1346 ? mySwiper2.params.slidesPerViewByWap 1347 : 1; 1348 slidesPerGroup = 1349 mySwiper2.params.slidesPerGroupByWap != undefined 1350 ? mySwiper2.params.slidesPerGroupByWap 1351 : 1; 1352 mySwiper2.params.tdFlow = ""; 1353 } 1354 if (typeof mySwiper2 != "undefined") { 1355 mySwiper2.params.slidesPerView = slidesPerView; 1356 mySwiper2.params.slidesPerGroup = slidesPerGroup; 1357 mySwiper2.reInit(); 1358 } 1359 reAside(options, mySwiper2); 1360 } 1361 _this.find(".arrow-left").on("click", function (e) { 1362 e.preventDefault(); 1363 swiperObject[swiper].swipePrev(); 1364 }); 1365 _this.find(".arrow-right").on("click", function (e) { 1366 e.preventDefault(); 1367 swiperObject[swiper].swipeNext(); 1368 }); 1369 var _this_swiper = $("#" + swiper); 1370 1371 reAside(swiperObject[swiper]); 1372 function reAside(_options, mySwiper2) { 1373 //妿æé®é è¾¹,æ´æ¹æ´ä½swiper-slideæ ·å¼ 1374 if (!_options.btnAside) { 1375 return; 1376 } 1377 var style_str = ""; 1378 if (mySwiper2.params.slidesPerView == 3) { 1379 style_str = 1380 "<style>" + 1381 "#" + 1382 swiper + 1383 " .swiper-slide-active img { margin-left: -2.5%} " + 1384 "#" + 1385 swiper + 1386 " .swiper-slide-active + div img { margin-left: 1.5%} " + 1387 "#" + 1388 swiper + 1389 " .swiper-slide-active + div + div img { margin-left: 5.5% }" + 1390 "#" + 1391 swiper + 1392 " .swiper-slide-active p { margin-left: -2.5%} " + 1393 "#" + 1394 swiper + 1395 " .swiper-slide-active + div p { margin-left: 1.5%} " + 1396 "#" + 1397 swiper + 1398 " .swiper-slide-active + div + div p { margin-left: 5.5% }" + 1399 "</style>"; 1400 // _this_swiper.find('.swiper-slide-active img').css({marginLeft: '-3%'}); 1401 // _this_swiper.find('.swiper-slide-active').next().next().find('img').css({marginLeft: '2%'}) 1402 } else if (mySwiper2.params.slidesPerView == 4) { 1403 style_str = 1404 "<style>" + 1405 "#" + 1406 swiper + 1407 " .swiper-slide-active img { margin-left: -2.5%} " + 1408 "#" + 1409 swiper + 1410 " .swiper-slide-active + div img { margin-left: 0 } " + 1411 "#" + 1412 swiper + 1413 " .swiper-slide-active + div + div img { margin-left: 2.5% } " + 1414 "#" + 1415 swiper + 1416 " .swiper-slide-active + div + div + div img { margin-left: 5.5% } " + 1417 "#" + 1418 swiper + 1419 " .swiper-slide-active p { margin-left: -2.5%} " + 1420 "#" + 1421 swiper + 1422 " .swiper-slide-active + div p { margin-left: 0 } " + 1423 "#" + 1424 swiper + 1425 " .swiper-slide-active + div + div p { margin-left: 2.5% } " + 1426 "#" + 1427 swiper + 1428 " .swiper-slide-active + div + div + div p { margin-left: 5.5% } " + 1429 "</style>"; 1430 // _this_swiper.find('.swiper-slide-active img').css({marginLeft: '-2.5%'});
1431 // _this_swiper.find('.swiper-slide-active').next().find('img').css({marginLeft: '-2.5%'}); 1432 // _this_swiper.find('.swiper-slide-active').next().next().find('img').css({marginLeft: '-1.7%'}); 1433 // _this_swiper.find('.swiper-slide-active').next().next().next().find('img').css({marginLeft: '-1.6%'}); 1434 // _this_swiper.find('.swiper-slide-active').next().next().next().next().find('img').css({marginRight: '-2.5%'}); 1435 } 1436 if ($("#" + swiper + "_style").length == 0) { 1437 $("body").append('<div id="' + swiper + '_style"></div>'); 1438 } 1439 $("#" + swiper + "_style").html(style_str); 1440 } 1441} 1442 1443/** 1444 * 第ä¸ç§è½®æï¼å 容èªå®ä¹ 1445 * @param options 1446 * @param _this 1447 */ 1448function swiper3(options, _this) { 1449 var swiper = options.swiper, 1450 swiperPagination; 1451 _this.attr("id", swiper).addClass("SWIPER-3"); 1452 if ($("#" + swiper + " .pagination").length == 0) { 1453 swiperPagination = ""; 1454 } else { 1455 swiperPagination = "#" + swiper + " .pagination"; 1456 } 1457 swiperObject[swiper] = new Swiper("#" + swiper + " .swiper-container", { 1458 pagination: swiperPagination, 1459 loop: options.loop != undefined ? options.loop : true, 1460 speed: options.speed != undefined ? options.speed : 500, 1461 autoplay: options.autoplay != undefined ? options.autoplay : 3000, 1462 grabCursor: options.grabCursor != undefined ? options.grabCursor : false, 1463 paginationClickable: 1464 options.paginationClickable != undefined 1465 ? options.paginationClickable 1466 : true, 1467 autoplayDisableOnInteraction: false 1468 }); 1469 _this.find(".arrow-left").on("click", function (e) { 1470 e.preventDefault(); 1471 swiperObject[swiper].swipePrev(); 1472 }); 1473 _this.find(".arrow-right").on("click", function (e) { 1474 e.preventDefault(); 1475 swiperObject[swiper].swipeNext(); 1476 }); 1477} 1478 1479/** 1480 *å°åºäº1200pxççåå¨å°äº768px以ä¸ï¼è¿è¡åæ¯ä¾ç¼©æ¾ 1481 */ 1482function boxReSizeToWap(options) { 1483 var _this = $(options._this); 1484 if ($(window).width() > 768) { 1485 return; 1486 } 1487 var boxWidth = parseInt(_this.width()); 1488 var size = (boxWidth * 2) / 1200; 1489 _this.css("transform", "scale(" + size + ")").css("transform-origin", "0 0"); 1490} 1491 1492/** 1493 *å°åºäº1200pxç页é¢å¨å°äº768px以ä¸ï¼è¿è¡åæ¯ä¾ç¼©æ¾ 1494 */ 1495function pageReSizeToWap() { 1496 if ($(window).width() > 768) { 1497 return; 1498 } 1499 var viewport = document.querySelector("meta[name=viewport]"); 1500 if (!viewport) { 1501 $("head").append( 1502 '<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">' 1503 ); 1504 } 1505 if (!document.querySelector("meta[http-equiv]")) { 1506 $("head").append('<meta http-equiv="X-UA-Compatible" content="ie=edge">'); 1507 } 1508 var viewport = document.querySelector("meta[name=viewport]"); 1509 var winWidth = $(window).width(); 1510 var winHeight = $("body").height(); 1511 var size = winWidth / 1200; 1512 $( 1513 " body, footer, footer .foot-top, footer .foot-bottom, footer .foot-top .foot-t-cont" 1514 ).css({ width: "12rem" }); 1515 $("html").css({ 1516 "font-size": "100px", 1517 transform: "scale(" + size + ")", 1518 "transform-origin": "0 0", 1519 width: "12rem", 1520 height: winHeight * size + "px" 1521 }); 1522} 1523 1524/** 1525 * ç¹å»å¾æ åå°é¡¶é¨ 1526 * @Author: Mr.Hu 1527 * @Date: 2020-12-17 22:20 1528 * @Last Modified by: Mr.Hu 1529 * @Last Modified time: 2020-12-17 22:20 1530 */ 1531(function () { 1532 var scrollDom = $(".SCROLLTOP"); 1533 if (scrollDom.length < 1) { 1534 return; 1535 } 1536 // $('body').append('<div class="SCROLLTOP"><img src="/images/scrollTop.png"></div>'); 1537 $("body").on("click", ".SCROLLTOP", function () { 1538 $("html,body").animate({ scrollTop: 0 }, 500, "swing"); 1539 }); 1540 $(window).scroll(function () { 1541 var scrollTop = $(document).scrollTop(); 1542 if (scrollTop <= 400) { 1543 $(".SCROLLTOP").fadeOut(); 1544 } else { 1545 $(".SCROLLTOP").fadeIn(); 1546 } 1547 }); 1548})(); 1549 1550/** 1551 * æ²å»é®çäºä»¶ 1552 * obj Object 1553 * el String csséæ© å¨é»è®¤ä¸º document 1554 * keyCode Number é®çç é»è®¤æ¯åè½¦é® 1555 * showCode Boolean æ§å¶å°ææå°ææé®ççé®ç é»è®¤ä¸æå° 1556 * callBack Function æä¸å¯¹åºé®çææå¤ççä¸å¡é»è¾ 1557 * */ 1558 1559function keyboardEv(obj) { 1560 var dName = obj.el || document, 1561 keyCode = obj.keyCode || 13; 1562 $(dName).on("keypress", function (e) { 1563 obj.showCode && console.log(obj.showCode); 1564 if (e.keyCode == keyCode) { 1565 obj.callBack && obj.callBack(); 1566 } 1567 }); 1568} 1569 1570/** 1571 * ajax ç½ç»è¯·æ± 1572 * @param resUrl 请æ±å°å 1573 * @param type 请æ±ç±»å 1574 * @param url 请æ±å°å 1575 * @param param 请æ±åæ° 1576 * @param callbackåè°å½æ° 1577 */ 1578var resUrl = {}; 1579var baseUrl = "http://www.cq.gov.cn/"; 1580resUrl.getZCJJUrl = "govserver/tors/businessEnv/zh/policy/highlight.html"; //è·åæ¿çç´é车-æ¿çé馿°æ® 1581 1582function sendAjax(type, url, param, callback) { 1583 $.ajax({
1584 type: type, 1585 url: baseUrl + url, 1586 data: param, 1587 success: callback, 1588 error: function (res) { 1589 console.log(res); 1590 } 1591 }); 1592} 1593 1594/**å»ºè¡æ¥å£è¯·æ±çå°è£ åèæ¸å¿«å建è¡ajax 1595 * obj 1596 * body // å®ä½ä¿¡æ¯ 1597 * page // åé¡µä¿¡æ¯ 1598 * // pageIndex å½å页 1599 * // pageSize æ¯é¡µæ¡æ° 1600 * success æåä¹åçåè° 1601 * */ 1602function jhAJAX(obj) { 1603 // todo item.DEPTNAME åºåç¼ç item.AREACODE == 5 å±äºè¡é 1604 var op = packPayload(obj.body, obj.page); 1605 1606 $.ajax({ 1607 url: obj.url, //self.BASEURL + 1608 type: obj.method || "post", 1609 headers: { "Content-Type": "application/json" }, 1610 data: JSON.stringify(op), 1611 dataType: "text", 1612 success: function (res) { 1613 res = JSON.parse(res); 1614 if (res["C-Response-Desc"] == "success") { 1615 res = JSON.parse(res["C-Response-Body"]); 1616 obj.success(res); 1617 } else { 1618 console.log("æå¡åºé"); 1619 } 1620 }, 1621 error: function (err) { 1622 console.log("ç½ç»é误"); 1623 } 1624 }); 1625} 1626 1627/** 1628 * @param payload 请æ±çdata {} 1629 * @param page 请æ±çæ°æ®çå页 1630 * @param headers 请æ±å¤´ 1631 */ 1632function packPayload(payload, page) { 1633 // é»è®¤è¯·æ±åéè¦å¸¦çåæ° 1634 var txnCommCom = { 1635 txnIttChnlId: "C0071234567890987654321", 1636 txnIttChnlCgyCode: "BC01C101" 1637 }; 1638 1639 // 妿æå页ï¼ç»è£ å页 1640 if (page) { 1641 txnCommCom.tRecInPage = page.pageSize; // å页æ°é 1642 txnCommCom.tPageJump = page.pageIndex; // å页页ç 1643 } 1644 1645 var payload2 = {}; 1646 for (var i in payload) { 1647 //for in ä¼éå对象ç屿§ï¼å æ¬å®ä¾ä¸åååä¸ç屿§ãï¼ 1648 payload2[i] = payload[i]; 1649 } 1650 return { 1651 txnCommCom: txnCommCom, 1652 txnBodyCom: payload2 1653 }; 1654}
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.