1/*! 2 * SuperSlide v2.0 3 * è½»æ¾è§£å³ç½ç«å¤§é¨åç¹æå±ç¤ºé®é¢ 4 * 详尽信æ¯è¯·çå®ç½ï¼http://www.SuperSlide2.com/ 5 * 6 * Copyright 2011-2013, 大è¯ä¸»å¸ 7 * 8 * 请å°éååï¼ä¿ç头é¨çæ 9 * å¨ä¿ççæçåæä¸å¯åºç¨äºä¸ªäººæåä¸ç¨é 10 */ 11 12; (function ($) { 13 var defaults = { 14 effect: 'fade', 15 autoPlay: true, 16 delayTime: 500, 17 interTime: 5000, 18 triggerTime: 150, 19 defaultIndex: 0, 20 titCell: '.hd li', 21 mainCell: '.bd', 22 targetCell: null, 23 trigger: 'mouseover', 24 scroll: 1, 25 vis: 1, 26 titOnClassName: 'on', 27 autoPage: false, 28 prevCell: '.prev', 29 nextCell: '.next', 30 pageStateCell: '.pageState', 31 opp: false, 32 pnLoop: true, 33 easing: 'linear', 34 startFun: null, 35 endFun: null, 36 switchLoad: null, 37 imgfull: false 38 } 39 $.fn.slideNew = function (options) { 40 if (this.length == 0) return this 41 42 // support mutltiple elements 43 if (this.length > 1) { 44 this.each(function () { 45 $(this).slideNew(options) 46 }) 47 return this 48 } 49 var el = this 50 51 return this.each(function () { 52 var opts = $.extend({}, defaults, options) 53 var effect = opts.effect 54 var prevBtn = $(opts.prevCell, $(this)) 55 var nextBtn = $(opts.nextCell, $(this)) 56 var pageState = $(opts.pageStateCell, $(this)) 57 var navObj = $(opts.titCell, $(this)) //导èªåå ç´ ç»å 58 var navObjSize = navObj.length 59 var conBox = $(opts.mainCell, $(this)) //å 容å ç´ ç¶å±å¯¹è±¡ 60 var conBoxSize = conBox.children().length 61 var sLoad = opts.switchLoad 62 if (opts.targetCell != null) { 63 var tarObj = $(opts.targetCell, $(this)) 64 } 65 66 /*å符串转æ¢ä¸ºæ°å*/ 67 var index = parseInt(opts.defaultIndex) 68 var delayTime = parseInt(opts.delayTime) 69 var interTime = parseInt(opts.interTime) 70 var triggerTime = parseInt(opts.triggerTime) 71 var scroll = parseInt(opts.scroll) 72 var vis = parseInt(opts.vis) 73 var autoPlay = opts.autoPlay == 'false' || opts.autoPlay == false ? false : true 74 var opp = opts.opp == 'false' || opts.opp == false ? false : true 75 var autoPage = opts.autoPage == 'false' || opts.autoPage == false ? false : true 76 var loop = opts.pnLoop == 'false' || opts.pnLoop == false ? false : true 77 var imgfull = opts.imgfull == 'false' || opts.imgfull == false ? false : true 78 79 var slideH = 0 80 var slideW = 0 81 var selfW = 0 82 var selfH = 2000 83 var easing = opts.easing 84 var inter = null //setIntervalåç§° 85 var oldIndex = index 86 var working = false 87 var isScrolling 88 89 //å¤çå页 90 if (navObjSize == 0) navObjSize = conBoxSize 91 if (autoPage) { 92 var tempS = conBoxSize - vis 93 navObjSize = 1 + parseInt(tempS % scroll != 0 ? tempS / scroll + 1 : tempS / scroll) 94 if (navObjSize <= 0) navObjSize = 1 95 navObj.html('') 96 for (var i = 0; i < navObjSize; i++) { 97 navObj.append('<li>' + (i + 1) + '</li>') 98 } 99 var navObj = $('li', navObj) //é置导èªåå ç´ å¯¹è±¡ 100 } 101 102 if (imgfull) { 103 switch (effect) { 104 case 'top': 105 case 'topLoop': 106 case 'topMarquee': 107 case 'bottomLoop': 108 case 'bottomMarquee': 109 conBox 110 .children() 111 .find('img') 112 .css({ width: '100%' }) 113 break 114 } 115 } 116 conBox.children().each(function () { 117 //åæå¤§å¼ 118 if ($(this).width() > selfW) { 119 selfW = $(this).outerWidth() 120 slideW = $(this).outerWidth(true) 121 if (navigator.appName == 'Microsoft Internet Explorer' && navigator.appVersion.split(';')[1].replace(/[ ]/g, '') == 'MSIE7.0') { 122 selfW = $(this).width() 123 } 124 } 125 if ($(this).height() < selfH) { 126 selfH = $(this).height() 127 slideH = $(this).outerHeight(true) 128 } 129 }) 130 if (imgfull) { 131 var oneImgW = conBox 132 .find('img') 133 .eq(0) 134 .width() 135 var oneImgH = conBox 136 .find('img') 137 .eq(0) 138 .height() 139 var imgHN = (oneImgH * selfW) / oneImgW 140 switch (effect) { 141 case 'fold': 142 case 'left': 143 case 'leftLoop': 144 case 'leftMarquee': 145 case 'rightLoop': 146 case 'rightMarquee': 147 conBox 148 .children() 149 .find('img') 150 .css({ width: '100%', height: imgHN }) 151 break 152 } 153 } 154 if (conBoxSize >= vis) { 155 //å½å 容个æ°å°äºå¯è§ä¸ªæ°ï¼ä¸æ§è¡ææã 156 switch (effect) { 157 case 'fold': 158 conBox 159 .css({ position: 'relative', width: slideW, height: slideH }) 160 .children() 161 .css({ position: 'absolute', width: selfW, left: 0, top: 0, display: 'none' }) 162 break 163 case 'top': 164 conBox 165 .wrap('<div class="tempWrap" style="overflow:hidden; position:relative; height:' + vis * slideH + 'px"></div>') 166 .css({ position: 'relative', padding: '0', margin: '0' }) 167 .children() 168 .css({ height: selfH }) 169 break 170 case 'left': 171 conBox 172 .wrap('<div class="tempWrap" style="overflow:hidden; position:relative; width:' + vis * slideW + 'px"></div>') 173 .css({ width: conBoxSize * slideW, position: 'relative', overflow: 'hidden', padding: '0', margin: '0' }) 174 .children() 175 .css({ float: 'left', width: selfW }) 176 break 177 case 'leftLoop': 178 case 'leftMarquee': 179 conBox 180 .children() 181 .clone() 182 .appendTo(conBox) 183 .clone() 184 .prependTo(conBox) 185 conBox 186 .wrap('<div class="tempWrap" style="overflow:hidden; position:relative; width:' + vis * slideW + 'px"></div>') 187 .css({ width: conBoxSize * slideW * 3, position: 'relative', overflow: 'hidden', padding: '0', margin: '0', left: -conBoxSize * slideW }) 188 .children() 189 .css({ float: 'left', width: selfW }) 190 break 191 case 'rightLoop': 192 case 'rightMarquee': 193 conBox 194 .children() 195 .clone() 196 .appendTo(conBox) 197 .clone() 198 .prependTo(conBox) 199 conBox 200 .wrap('<div class="tempWrap" style="overflow:hidden; position:relative; width:' + vis * slideW + 'px"></div>') 201 .css({ width: conBoxSize * slideW * 3, position: 'relative', overflow: 'hidden', padding: '0', margin: '0', left: -conBoxSize * slideW }) 202 .children() 203 .css({ float: 'left', width: selfW }) 204 break 205 case 'topLoop': 206 case 'topMarquee': 207 conBox 208 .children() 209 .clone() 210 .appendTo(conBox) 211 .clone() 212 .prependTo(conBox) 213 conBox 214 .wrap('<div class="tempWrap" style="overflow:hidden; position:relative; height:' + vis * slideH + 'px"></div>') 215 .css({ height: conBoxSize * slideH * 3, position: 'relative', padding: '0', margin: '0', top: -conBoxSize * slideH }) 216 .children() 217 .css({ height: selfH }) 218 break 219 case 'bottomLoop': 220 case 'bottomMarquee': 221 conBox 222 .children() 223 .clone() 224 .appendTo(conBox) 225 .clone() 226 .prependTo(conBox) 227 conBox 228 .wrap('<div class="tempWrap" style="overflow:hidden; position:relative; height:' + vis * slideH + 'px"></div>') 229 .css({ height: conBoxSize * slideH * 3, position: 'relative', padding: '0', margin: '0', top: -conBoxSize * slideH }) 230 .children() 231 .css({ height: selfH }) 232 break 233 } 234 } 235 $(window).on('resize', function () { 236 resizeWindow() 237 }) 238 var resizeWindow = function (e) { 239 if (effect !== 'fade') { 240 conBox.removeAttr('style') 241 conBox.children().removeAttr('style') 242 conBox.parent().removeAttr('style') 243 } 244 slideH = 0 245 slideW = 0 246 selfW = 0 247 selfH = 2000 248 conBox.children().each(function () { 249 //åæå¤§å¼ 250 if ($(this).width() > selfW) { 251 selfW = $(this).outerWidth() 252 slideW = $(this).outerWidth(true) 253 if (navigator.appName == 'Microsoft Internet Explorer' && navigator.appVersion.split(';')[1].replace(/[ ]/g, '') == 'MSIE7.0') { 254 selfW = $(this).width() 255 } 256 } 257 if ($(this).height() < selfH) { 258 selfH = $(this).height() 259 slideH = $(this).outerHeight(true) 260 } 261 }) 262 if (imgfull) { 263 var imgHN = (oneImgH * selfW) / oneImgW 264 switch (effect) { 265 case 'fold': 266 case 'left': 267 case 'leftLoop': 268 case 'leftMarquee': 269 case 'rightLoop': 270 case 'rightMarquee': 271 conBox 272 .children() 273 .find('img') 274 .css({ width: '100%', height: imgHN }) 275 break 276 } 277 } 278 if (conBoxSize >= vis) { 279 //å½å 容个æ°å°äºå¯è§ä¸ªæ°ï¼ä¸æ§è¡ææã 280 switch (effect) { 281 case 'fold': 282 conBox 283 .css({ position: 'relative', width: slideW, height: slideH }) 284 .children() 285 .css({ position: 'absolute', width: selfW, left: 0, top: 0, display: 'none' }) 286 break 287 case 'top': 288 conBox.parent().css({ overflow: 'hidden', position: 'relative', height: vis * slideH }) 289 conBox 290 .css({ position: 'relative', padding: '0', margin: '0' }) 291 .children() 292 .css({ height: selfH }) 293 break 294 case 'left': 295 conBox.parent().css({ overflow: 'hidden', position: 'relative', width: vis * slideW }) 296 conBox 297 .css({ width: conBoxSize * slideW, position: 'relative', overflow: 'hidden', padding: '0', margin: '0' }) 298 .children() 299 .css({ float: 'left', width: selfW }) 300 break 301 case 'leftLoop': 302 case 'leftMarquee': 303 conBox.parent().css({ overflow: 'hidden', position: 'relative', width: vis * slideW }) 304 conBox 305 .css({ width: conBoxSize * slideW * 3, position: 'relative', overflow: 'hidden', padding: '0', margin: '0', left: -conBoxSize * slideW }) 306 .children() 307 .css({ float: 'left', width: selfW }) 308 break 309 case 'rightLoop': 310 case 'rightMarquee': 311 conBox.parent().css({ overflow: 'hidden', position: 'relative', width: vis * slideW }) 312 conBox 313 .css({ width: conBoxSize * slideW * 3, position: 'relative', overflow: 'hidden', padding: '0', margin: '0', left: -conBoxSize * slideW }) 314 .children() 315 .css({ float: 'left', width: selfW }) 316 break 317 case 'topLoop': 318 case 'topMarquee': 319 conBox.parent().css({ overflow: 'hidden', position: 'relative', height: vis * slideH }) 320 conBox 321 .css({ height: conBoxSize * slideH * 3, position: 'relative', padding: '0', margin: '0', top: -conBoxSize * slideH }) 322 .children() 323 .css({ height: selfH }) 324 break 325 case 'bottomLoop': 326 case 'bottomMarquee': 327 conBox.parent().css({ overflow: 'hidden', position: 'relative', height: vis * slideH }) 328 conBox 329 .css({ height: conBoxSize * slideH * 3, position: 'relative', padding: '0', margin: '0', top: -conBoxSize * slideH }) 330 .children() 331 .css({ height: selfH }) 332 break 333 } 334 } 335 doPlay() 336 } 337 338 var doStartFun = function () { 339 if (typeof opts.startFun === "function") { 340 opts.startFun(index, navObjSize) 341 } 342 } 343 var doEndFun = function () { 344 if (typeof opts.endFun === "function") { 345 opts.endFun(index, navObjSize) 346 } 347 } 348 var doSwitchLoad = function (objs) { 349 objs 350 .eq(index) 351 .find('img') 352 .each(function () { 353 if (typeof $(this).attr(sLoad) != 'undefined') { 354 $(this) 355 .attr('src', $(this).attr(sLoad)) 356 .removeAttr(sLoad) 357 } 358 }) 359 } 360 361 //ææå½æ° 362 var doPlay = function (isFirst) { 363 if (oldIndex == index && !isFirst && effect != 'leftMarquee' && effect != 'topMarquee' && effect != 'rightMarquee' && effect != 'bottomMarquee') return // å½åé¡µç¶æä¸è§¦åææ 364 switch (effect) { 365 case 'fade': 366 case 'fold': 367 case 'top': 368 case 'left': 369 if (index >= navObjSize) { 370 index = 0 371 } else if (index < 0) { 372 index = navObjSize - 1 373 } 374 break 375 case 'leftMarquee': 376 case 'topMarquee': 377 if (index >= 1) { 378 index = 1 379 } else if (index <= 0) { 380 index = 0 381 } 382 break 383 case 'rightMarquee': 384 case 'bottomMarquee': 385 if (index >= 1) { 386 index = 1 387 } else if (index <= 0) { 388 index = 0 389 } 390 break 391 case 'leftLoop': 392 case 'topLoop': 393 var tempNum = index - oldIndex 394 if (navObjSize > 2 && tempNum == -(navObjSize - 1)) tempNum = 1 395 if (navObjSize > 2 && tempNum == navObjSize - 1) tempNum = -1 396 var scrollNum = Math.abs(tempNum * scroll) 397 if (index >= navObjSize) { 398 index = 0 399 } else if (index < 0) { 400 index = navObjSize - 1 401 } 402 case 'rightLoop': 403 case 'bottomLoop': 404 var tempNum = index - oldIndex 405 if (navObjSize > 2 && tempNum == -(navObjSize - 1)) tempNum = 1 406 if (navObjSize > 2 && tempNum == navObjSize - 1) tempNum = -1 407 var scrollNum = Math.abs(tempNum * scroll) 408 if (index >= navObjSize) { 409 index = 0 410 } else if (index < 0) { 411 index = navObjSize - 1 412 } 413 break 414 } 415 416 doStartFun() 417 418 //å¤ç忢å è½½ 419 if (sLoad != null) { 420 doSwitchLoad(conBox.children()) 421 } 422 423 //å¤çtargetCell 424 if (tarObj) { 425 if (sLoad != null) { 426 doSwitchLoad(tarObj) 427 } 428 tarObj 429 .hide() 430 .eq(index) 431 .animate({ opacity: 'show' }, delayTime, function () { 432 if (!conBox[0]) doEndFun() 433 }) 434 } 435 436 if (conBoxSize >= vis) { 437 //å½å 容个æ°å°äºå¯è§ä¸ªæ°ï¼ä¸æ§è¡ææã 438 switch (effect) { 439 case 'fade': 440 conBox 441 .children() 442 .stop(true, true) 443 .eq(index) 444 .animate({ opacity: 'show' }, delayTime, easing, function () { 445 doEndFun() 446 }) 447 .siblings() 448 .hide() 449 break 450 case 'fold': 451 conBox 452 .children() 453 .stop(true, true) 454 .eq(index) 455 .animate({ opacity: 'show' }, delayTime, easing, function () { 456 doEndFun() 457 }) 458 .sibli
458ngs() 459 .animate({ opacity: 'hide' }, delayTime, easing) 460 break 461 case 'top': 462 conBox.stop(true, false).animate({ top: -index * scroll * slideH }, delayTime, easing, function () { 463 doEndFun() 464 }) 465 break 466 case 'left': 467 conBox.stop(true, false).animate({ left: -index * scroll * slideW }, delayTime, easing, function () { 468 doEndFun() 469 }) 470 break 471 case 'leftLoop': 472 if (tempNum < 0) { 473 conBox.stop(true, true).animate({ left: -(conBoxSize - scrollNum) * slideW }, delayTime, easing, function () { 474 for (var i = 0; i < scrollNum; i++) { 475 conBox 476 .children() 477 .last() 478 .prependTo(conBox) 479 } 480 conBox.css('left', -conBoxSize * slideW) 481 doEndFun() 482 }) 483 } else { 484 conBox.stop(true, true).animate({ left: -(conBoxSize + scrollNum) * slideW }, delayTime, easing, function () { 485 for (var i = 0; i < scrollNum; i++) { 486 conBox 487 .children() 488 .eq(0) 489 .appendTo(conBox) 490 } 491 conBox.css('left', -conBoxSize * slideW) 492 doEndFun() 493 }) 494 } 495 break // leftLoop end 496 case 'rightLoop': 497 if (tempNum < 0) { 498 conBox.stop(true, true).animate({ left: -(conBoxSize + scrollNum) * slideW }, delayTime, easing, function () { 499 for (var i = 0; i < scrollNum; i++) { 500 conBox 501 .children() 502 .eq(0) 503 .appendTo(conBox) 504 } 505 conBox.css('left', -conBoxSize * slideW) 506 doEndFun() 507 }) 508 } else { 509 conBox.stop(true, true).animate({ left: -(conBoxSize - scrollNum) * slideW }, delayTime, easing, function () { 510 for (var i = 0; i < scrollNum; i++) { 511 conBox 512 .children() 513 .last() 514 .prependTo(conBox) 515 } 516 conBox.css('left', -conBoxSize * slideW) 517 doEndFun() 518 }) 519 } 520 break // rightLoop end 521 case 'topLoop': 522 if (tempNum < 0) { 523 conBox.stop(true, true).animate({ top: -(conBoxSize - scrollNum) * slideH }, delayTime, easing, function () { 524 for (var i = 0; i < scrollNum; i++) { 525 conBox 526 .children() 527 .last() 528 .prependTo(conBox) 529 } 530 conBox.css('top', -conBoxSize * slideH) 531 doEndFun() 532 }) 533 } else { 534 conBox.stop(true, true).animate({ top: -(conBoxSize + scrollNum) * slideH }, delayTime, easing, function () { 535 for (var i = 0; i < scrollNum; i++) { 536 conBox 537 .children() 538 .first() 539 .appendTo(conBox) 540 } 541 conBox.css('top', -conBoxSize * slideH) 542 doEndFun() 543 }) 544 } 545 break //topLoop end 546 case 'bottomLoop': 547 if (tempNum < 0) { 548 conBox.stop(true, true).animate({ top: -(conBoxSize + scrollNum) * slideH }, delayTime, easing, function () { 549 for (var i = 0; i < scrollNum; i++) { 550 conBox 551 .children() 552 .first() 553 .appendTo(conBox) 554 } 555 conBox.css('top', -conBoxSize * slideH) 556 doEndFun() 557 }) 558 } else { 559 conBox.stop(true, true).animate({ top: -(conBoxSize - scrollNum) * slideH }, delayTime, easing, function () { 560 for (var i = 0; i < scrollNum; i++) { 561 conBox 562 .children() 563 .last() 564 .prependTo(conBox) 565 } 566 conBox.css('top', -conBoxSize * slideH) 567 doEndFun() 568 }) 569 } 570 break //bottomLoop end 571 572 case 'leftMarquee': 573 var tempLeft = conBox.css('left').replace('px', '') 574 575 if (index == 0) { 576 conBox.animate({ left: ++tempLeft }, 0, function () { 577 if (conBox.css('left').replace('px', '') >= 0) { 578 for (var i = 0; i < conBoxSize; i++) { 579 conBox 580 .children() 581 .last() 582 .prependTo(conBox) 583 } 584 conBox.css('left', -conBoxSize * slideW) 585 } 586 }) 587 } else { 588 conBox.animate({ left: --tempLeft }, 0, function () { 589 if (conBox.css('left').replace('px', '') <= -conBoxSize * slideW * 2) { 590 for (var i = 0; i < conBoxSize; i++) { 591 conBox 592 .children() 593 .first() 594 .appendTo(conBox) 595 } 596 conBox.css('left', -conBoxSize * slideW) 597 } 598 }) 599 } 600 break // leftMarquee end 601 case 'rightMarquee': 602 var tempLeft = conBox.css('left').replace('px', '') 603 if (index == 0) { 604 conBox.animate({ left: --tempLeft }, 0, function () { 605 if (conBox.css('left').replace('px', '') <= -conBoxSize * slideW * 2) { 606 for (var i = 0; i < conBoxSize; i++) { 607 conBox 608 .children() 609 .first() 610 .appendTo(conBox) 611 } 612 conBox.css('left', -conBoxSize * slideW) 613 } 614 }) 615 } else { 616 conBox.animate({ left: ++tempLeft }, 0, function () { 617 if (conBox.css('left').replace('px', '') >= 0) { 618 for (var i = 0; i < conBoxSize; i++) { 619 conBox 620 .children() 621 .last() 622 .prependTo(conBox) 623 } 624 conBox.css('left', -conBoxSize * slideW) 625 } 626 }) 627 } 628 break // rightMarquee end 629 630 case 'topMarquee': 631 var tempTop = conBox.css('top').replace('px', '') 632 if (index == 0) { 633 conBox.animate({ top: ++tempTop }, 0, function () { 634 if (conBox.css('top').replace('px', '') >= 0) { 635 for (var i = 0; i < conBoxSize; i++) { 636 conBox 637 .children() 638 .last() 639 .prependTo(conBox) 640 } 641 conBox.css('top', -conBoxSize * slideH) 642 } 643 }) 644 } else { 645 conBox.animate({ top: --tempTop }, 0, function () { 646 if (conBox.css('top').replace('px', '') <= -conBoxSize * slideH * 2) { 647 for (var i = 0; i < conBoxSize; i++) { 648 conBox 649 .children() 650 .first() 651 .appendTo(conBox) 652 } 653 conBox.css('top', -conBoxSize * slideH) 654 } 655 }) 656 } 657 break // topMarquee end 658 case 'bottomMarquee': 659 var tempTop = conBox.css('top').replace('px', '') 660 if (index == 0) { 661 conBox.animate({ top: --tempTop }, 0, function () { 662 if (conBox.css('top').replace('px', '') <= -conBoxSize * slideH * 2) { 663 for (var i = 0; i < conBoxSize; i++) { 664 conBox 665 .children() 666 .last() 667 .prependTo(conBox) 668 } 669 conBox.css('top', -conBoxSize * slideH) 670 } 671 }) 672 } else { 673 conBox.animate({ top: ++tempTop }, 0, function () { 674 if (conBox.css('top').replace('px', '') >= 0) { 675 for (var i = 0; i < conBoxSize; i++) { 676 conBox 677 .children() 678 .first() 679 .appendTo(conBox) 680 } 681 conBox.css('top', -conBoxSize * slideH) 682 } 683 }) 684 } 685 break // bottomMarquee end 686 } //switch end 687 } 688 navObj 689 .removeClass(opts.titOnClassName) 690 .eq(index) 691 .addClass(opts.titOnClassName) 692 oldIndex = index 693 if (loop == false) { 694 //loopæ§å¶æ¯å¦ç»§ç»å¾ªç¯ 695 nextBtn.removeClass('nextStop') 696 prevBtn.removeClass('prevStop') 697 if (index == 0) { 698 prevBtn.addClass('prevStop') 699 } else if (index == navObjSize - 1) { 700 nextBtn.addClass('nextStop') 701 } 702 } 703 } 704 var add_point = function () { 705 var pages = '' 706 for (var i = 0; i < navObjSize; i++) { 707 if (i === index) { 708 pages += '<span class="active" ></span>' 709 } else { 710 pages += '<span></span>' 711 } 712 } 713 pageState.html(pages) 714 } 715 //åå§åæ§è¡ 716 doPlay(true) 717 //æ·»å æé® 718 add_point(true) 719 var add_active = function () { 720 var pagest = pageState.children('span') 721 pagest 722 .eq(index) 723 .siblings('span') 724 .removeClass('active') 725 pagest.eq(index).addClass('active') 726 } 727 //èªå¨ææ¾ 728 if (autoPlay) { 729 if (effect == 'leftMarquee' || effect == 'topMarquee' || effect == 'rightMarquee' || effect == 'bottomMarquee') { 730 if (opp) { 731 index-- 732 } else { 733 index++ 734 } 735 inter = setInterval(function () { 736 doPlay(), add_active() 737 }, interTime) 738 conBox.hover( 739 function () { 740 if (autoPlay) { 741 clearInterval(inter) 742 } 743 }, 744 function () { 745 if (autoPlay) { 746 clearInterval(inter) 747 inter = setInterval(function () { 748 doPlay(), add_active() 749 }, interTime) 750 } 751 } 752 ) 753 } else { 754 inter = setInterval(function () { 755 if (opp) { 756 index-- 757 } else { 758 index++ 759 } 760 doPlay(), add_active() 761 }, interTime) 762 $(this).hover( 763 function () { 764 if (autoPlay) { 765 clearInterval(inter) 766 } 767 }, 768 function () { 769 if (autoPlay) { 770 clearInterval(inter) 771 inter = setInterval(function () { 772 if (opp) { 773 index-- 774 } else { 775 index++ 776 } 777 doPlay(), add_active() 778 }, interTime) 779 } 780 } 781 ) 782 } 783 } 784 785 //é¼ æ äºä»¶ 786 var mst 787 if (opts.trigger == 'mouseover') { 788 navObj.hover( 789 function () { 790 index = navObj.index(this) 791 mst = window.setTimeout(doPlay, opts.triggerTime) 792 }, 793 function () { 794 clearTimeout(mst) 795 } 796 ) 797 } else { 798 navObj.click(function () { 799 index = navObj.index(this) 800 doPlay() 801 add_active() 802 }) 803 } 804 var goToNextSlide = function () { 805 if (loop == true || index != navObjSize - 1) { 806 index++ 807 doPlay() 808 add_active() 809 } 810 } 811 var goToPrevSlide = function () { 812 if (loop == true || index != 0) { 813 index-- 814 doPlay() 815 add_active() 816 } 817 } 818 nextBtn.click(function () { 819 if (loop == true || index != navObjSize - 1) { 820 index++ 821 doPlay() 822 add_active() 823 } 824 }) 825 prevBtn.click(function () { 826 if (loop == true || index != 0) { 827 index-- 828 doPlay() 829 add_active() 830 } 831 }) 832 var alist = pageState.children('span') 833 alist.each(function () { 834 $(this).on('click', function () { 835 var i = alist.index($(this)) 836 if (loop == true || index != i) { 837 index = i 838 doPlay() 839 add_active() 840 } 841 }) 842 }) 843 /** 844 * Initializes touch events 845 */ 846 var istouch = false 847 var xMovement, yMovement 848 var isTouchDevice = function () { 849 try { 850 document.createEvent('TouchEvent') 851 istouch = true 852 } catch (e) { 853 istouch = false 854 } 855 } 856 var initTouch = function () { 857 // initialize object to contain all touch values 858 el.touch = { 859 start: { x: 0, y: 0 }, 860 end: { x: 0, y: 0 } 861 } 862 el.on('touchstart', onTouchStart) 863 } 864 isTouchDevice() 865 /** 866 * Event handler for "touchstart" 867 * 868 * @param e (event) 869 * - DOM event object 870 */ 871 var onTouchStart = function (e) { 872 // record the original position when touch starts 873 el.touch.originalPos = el.position() 874 isScrolling = 0 875 var orig = e.originalEvent 876 // record the starting touch x, y coordinates
877 el.touch.start.x = orig.changedTouches[0].pageX 878 el.touch.start.y = orig.changedTouches[0].pageY 879 // on a "touchmove" event to the viewport 880 el.on('touchmove', onTouchMove) 881 // on a "touchend" event to the viewport 882 el.on('touchend', onTouchEnd) 883 } 884 885 /** 886 * Event handler for "touchmove" 887 * 888 * @param e (event) 889 * - DOM event object 890 */ 891 var onTouchMove = function (e) { 892 if (event.targetTouches.length > 1 || (e.scale && e.scale !== 1)) return 893 var orig = e.originalEvent 894 el.touch.end.x = orig.changedTouches[0].pageX 895 el.touch.end.y = orig.changedTouches[0].pageY 896 // if scrolling on y axis, do not prevent default 897 xMovement = Math.abs(el.touch.end.x - el.touch.start.x) 898 yMovement = Math.abs(el.touch.end.y - el.touch.start.y) 899 isScrolling = xMovement < yMovement ? 1 : 0 900 if (isScrolling === 0) { 901 e.preventDefault() 902 } 903 } 904 905 /** 906 * Event handler for "touchend" 907 * 908 * @param e (event) 909 * - DOM event object 910 */ 911 var onTouchEnd = function (e) { 912 if (isScrolling === 0) { 913 if (xMovement > 20) { 914 switch (effect) { 915 case 'fade': 916 case 'fold': 917 case 'left': 918 case 'leftLoop': 919 case 'leftMarquee': 920 el.touch.start.x > el.touch.end.x ? goToNextSlide() : goToPrevSlide() 921 break 922 case 'rightLoop': 923 case 'rightMarquee': 924 el.touch.start.x > el.touch.end.x ? goToPrevSlide() : goToNextSlide() 925 break 926 } 927 } 928 } 929 el.off('touchmove', onTouchMove) 930 el.off('touchend', onTouchEnd) 931 } 932 initTouch() 933 }) //each End 934 } //slide End 935})(jQuery) 936 937jQuery.easing['jswing'] = jQuery.easing['swing'] 938jQuery.extend(jQuery.easing, { 939 def: 'easeOutQuad', 940 swing: function (x, t, b, c, d) { 941 return jQuery.easing[jQuery.easing.def](x, t, b, c, d) 942 }, 943 easeInQuad: function (x, t, b, c, d) { 944 return c * (t /= d) * t + b 945 }, 946 easeOutQuad: function (x, t, b, c, d) { 947 return -c * (t /= d) * (t - 2) + b 948 }, 949 easeInOutQuad: function (x, t, b, c, d) { 950 if ((t /= d / 2) < 1) return (c / 2) * t * t + b 951 return (-c / 2) * (--t * (t - 2) - 1) + b 952 }, 953 easeInCubic: function (x, t, b, c, d) { 954 return c * (t /= d) * t * t + b 955 }, 956 easeOutCubic: function (x, t, b, c, d) { 957 return c * ((t = t / d - 1) * t * t + 1) + b 958 }, 959 easeInOutCubic: function (x, t, b, c, d) { 960 if ((t /= d / 2) < 1) return (c / 2) * t * t * t + b 961 return (c / 2) * ((t -= 2) * t * t + 2) + b 962 }, 963 easeInQuart: function (x, t, b, c, d) { 964 return c * (t /= d) * t * t * t + b 965 }, 966 easeOutQuart: function (x, t, b, c, d) { 967 return -c * ((t = t / d - 1) * t * t * t - 1) + b 968 }, 969 easeInOutQuart: function (x, t, b, c, d) { 970 if ((t /= d / 2) < 1) return (c / 2) * t * t * t * t + b 971 return (-c / 2) * ((t -= 2) * t * t * t - 2) + b 972 }, 973 easeInQuint: function (x, t, b, c, d) { 974 return c * (t /= d) * t * t * t * t + b 975 }, 976 easeOutQuint: function (x, t, b, c, d) { 977 return c * ((t = t / d - 1) * t * t * t * t + 1) + b 978 }, 979 easeInOutQuint: function (x, t, b, c, d) { 980 if ((t /= d / 2) < 1) return (c / 2) * t * t * t * t * t + b 981 return (c / 2) * ((t -= 2) * t * t * t * t + 2) + b 982 }, 983 easeInSine: function (x, t, b, c, d) { 984 return -c * Math.cos((t / d) * (Math.PI / 2)) + c + b 985 }, 986 easeOutSine: function (x, t, b, c, d) { 987 return c * Math.sin((t / d) * (Math.PI / 2)) + b 988 }, 989 easeInOutSine: function (x, t, b, c, d) { 990 return (-c / 2) * (Math.cos((Math.PI * t) / d) - 1) + b 991 }, 992 easeInExpo: function (x, t, b, c, d) { 993 return t == 0 ? b : c * Math.pow(2, 10 * (t / d - 1)) + b 994 }, 995 easeOutExpo: function (x, t, b, c, d) { 996 return t == d ? b + c : c * (-Math.pow(2, (-10 * t) / d) + 1) + b 997 }, 998 easeInOutExpo: function (x, t, b, c, d) { 999 if (t == 0) return b 1000 if (t == d) return b + c 1001 if ((t /= d / 2) < 1) return (c / 2) * Math.pow(2, 10 * (t - 1)) + b 1002 return (c / 2) * (-Math.pow(2, -10 * --t) + 2) + b 1003 }, 1004 easeInCirc: function (x, t, b, c, d) { 1005 return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b 1006 }, 1007 easeOutCirc: function (x, t, b, c, d) { 1008 return c * Math.sqrt(1 - (t = t / d - 1) * t) + b 1009 }, 1010 easeInOutCirc: function (x, t, b, c, d) { 1011 if ((t /= d / 2) < 1) return (-c / 2) * (Math.sqrt(1 - t * t) - 1) + b 1012 return (c / 2) * (Math.sqrt(1 - (t -= 2) * t) + 1) + b 1013 }, 1014 easeInElastic: function (x, t, b, c, d) { 1015 var s = 1.70158 1016 var p = 0 1017 var a = c 1018 if (t == 0) return b 1019 if ((t /= d) == 1) return b + c 1020 if (!p) p = d * 0.3 1021 if (a < Math.abs(c)) { 1022 a = c 1023 var s = p / 4 1024 } else var s = (p / (2 * Math.PI)) * Math.asin(c / a) 1025 return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin(((t * d - s) * (2 * Math.PI)) / p)) + b 1026 }, 1027 easeOutElastic: function (x, t, b, c, d) { 1028 var s = 1.70158 1029 var p = 0 1030 var a = c 1031 if (t == 0) return b 1032 if ((t /= d) == 1) return b + c 1033 if (!p) p = d * 0.3 1034 if (a < Math.abs(c)) { 1035 a = c 1036 var s = p / 4 1037 } else var s = (p / (2 * Math.PI)) * Math.asin(c / a) 1038 return a * Math.pow(2, -10 * t) * Math.sin(((t * d - s) * (2 * Math.PI)) / p) + c + b 1039 }, 1040 easeInOutElastic: function (x, t, b, c, d) { 1041 var s = 1.70158 1042 var p = 0 1043 var a = c 1044 if (t == 0) return b 1045 if ((t /= d / 2) == 2) return b + c 1046 if (!p) p = d * (0.3 * 1.5) 1047 if (a < Math.abs(c)) { 1048 a = c 1049 var s = p / 4 1050 } else var s = (p / (2 * Math.PI)) * Math.asin(c / a) 1051 if (t < 1) return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin(((t * d - s) * (2 * Math.PI)) / p)) + b 1052 return a * Math.pow(2, -10 * (t -= 1)) * Math.sin(((t * d - s) * (2 * Math.PI)) / p) * 0.5 + c + b 1053 }, 1054 easeInBack: function (x, t, b, c, d, s) { 1055 if (s == undefined) s = 1.70158 1056 return c * (t /= d) * t * ((s + 1) * t - s) + b 1057 }, 1058 easeOutBack: function (x, t, b, c, d, s) { 1059 if (s == undefined) s = 1.70158
1060 return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b 1061 }, 1062 easeInOutBack: function (x, t, b, c, d, s) { 1063 if (s == undefined) s = 1.70158 1064 if ((t /= d / 2) < 1) return (c / 2) * (t * t * (((s *= 1.525) + 1) * t - s)) + b 1065 return (c / 2) * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b 1066 }, 1067 easeInBounce: function (x, t, b, c, d) { 1068 return c - jQuery.easing.easeOutBounce(x, d - t, 0, c, d) + b 1069 }, 1070 easeOutBounce: function (x, t, b, c, d) { 1071 if ((t /= d) < 1 / 2.75) { 1072 return c * (7.5625 * t * t) + b 1073 } else if (t < 2 / 2.75) { 1074 return c * (7.5625 * (t -= 1.5 / 2.75) * t + 0.75) + b 1075 } else if (t < 2.5 / 2.75) { 1076 return c * (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375) + b 1077 } else { 1078 return c * (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375) + b 1079 } 1080 }, 1081 easeInOutBounce: function (x, t, b, c, d) { 1082 if (t < d / 2) return jQuery.easing.easeInBounce(x, t * 2, 0, c, d) * 0.5 + b 1083 return jQuery.easing.easeOutBounce(x, t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b 1084 } 1085})
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.