1/*! 2 * jQuery Cycle Plugin (with Transition Definitions) 3 * Examples and documentation at: http://jquery.malsup.com/cycle/ 4 * Copyright (c) 2007-2010 M. Alsup 5 * Version: 2.88 (08-JUN-2010) 6 * Dual licensed under the MIT and GPL licenses. 7 * http://jquery.malsup.com/license.html 8 * Requires: jQuery v1.2.6 or later 9 */ 10;(function($) { 11 12var ver = '2.88'; 13 14// if $.support is not defined (pre jQuery 1.3) add what I need 15if ($.support == undefined) { 16 $.support = { 17 opacity: !($.browser.msie) 18 }; 19} 20 21function debug(s) { 22 if ($.fn.cycle.debug) 23 log(s); 24} 25function log() { 26 if (window.console && window.console.log) 27 window.console.log('[cycle] ' + Array.prototype.join.call(arguments,' ')); 28}; 29 30// the options arg can be... 31// a number - indicates an immediate transition should occur to the given slide index 32// a string - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc) 33// an object - properties to control the slideshow 34// 35// the arg2 arg can be... 36// the name of an fx (only used in conjunction with a numeric value for 'options') 37// the value true (only used in first arg == 'resume') and indicates 38// that the resume should occur immediately (not wait for next timeout) 39 40$.fn.cycle = function(options, arg2) { 41 var o = { s: this.selector, c: this.context }; 42 43 // in 1.3+ we can fix mistakes with the ready state 44 if (this.length === 0 && options != 'stop') { 45 if (!$.isReady && o.s) { 46 log('DOM not ready, queuing slideshow'); 47 $(document).ready(function(){ 48 $(o.s,o.c).cycle(options,arg2); 49 }); 50 return this; 51 } 52 // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() 53 log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); 54 return this; 55 } 56 57 // iterate the matched nodeset 58 return this.each(function() { 59 var opts = handleArguments(this, options, arg2); 60 if (opts === false) 61 return; 62 63 opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink; 64 65 // stop existing slideshow for this container (if there is one) 66 if (this.cycleTimeout) 67 clearTimeout(this.cycleTimeout); 68 this.cycleTimeout = this.cyclePause = 0; 69 70 var $cont = $(this); 71 var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children(); 72 var els = $slides.get(); 73 if (els.length < 2) { 74 // #594 20120927 KAWANAKA div.type008TextDiv opacity bug fix 75 if($cont.hasClass("type008TextDiv")) $cont.css("opacity", opts.opacity); 76 log('terminating; too few slides: ' + els.length); 77 return; 78 } 79 80 var opts2 = buildOptions($cont, $slides, els, opts, o); 81 if (opts2 === false) 82 return; 83 84 var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.rev); 85 86 // if it's an auto slideshow, kick it off 87 if (startTime) { 88 startTime += (opts2.delay || 0); 89 if (startTime < 10) 90 startTime = 10; 91 debug('first timeout: ' + startTime); 92 this.cycleTimeout = setTimeout(function(){go(els,opts2,0,(!opts2.rev && !opts.backwards))}, startTime); 93 } 94 }); 95}; 96 97// process the args that were passed to the plugin fn 98function handleArguments(cont, options, arg2) { 99 if (cont.cycleStop == undefined) 100 cont.cycleStop = 0; 101 if (options === undefined || options === null) 102 options = {}; 103 if (options.constructor == String) { 104 switch(options) { 105 case 'destroy': 106 case 'stop': 107 var opts = $(cont).data('cycle.opts'); 108 if (!opts) 109 return false; 110 cont.cycleStop++; // callbacks look for change 111 if (cont.cycleTimeout) 112 clearTimeout(cont.cycleTimeout); 113 cont.cycleTimeout = 0; 114 $(cont).removeData('cycle.opts'); 115 if (options == 'destroy') 116 destroy(opts); 117 return false; 118 case 'toggle': 119 cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1; 120 checkInstantResume(cont.cyclePause, arg2, cont); 121 return false; 122 case 'pause': 123 cont.cyclePause = 1; 124 return false; 125 case 'resume': 126 cont.cyclePause = 0; 127 checkInstantResume(false, arg2, cont); 128 return false; 129 case 'prev': 130 case 'next': 131 var opts = $(cont).data('cycle.opts'); 132 if (!opts) { 133 log('options not found, "prev/next" ignored'); 134 return false; 135 } 136 $.fn.cycle[options](opts); 137 return false; 138 default: 139 options = { fx: options }; 140 }; 141 return options; 142 } 143 else if (options.constructor == Number) { 144 // go to the requested slide 145 var num = options; 146 options = $(cont).data('cycle.opts'); 147 if (!options) { 148 log('options not found, can not advance slide'); 149 return false; 150 } 151 if (num < 0 || num >= options.elements.length) { 152 log('invalid slide index: ' + num); 153 return false; 154 } 155 options.nextSlide = num; 156 if (cont.cycleTimeout) { 157 clearTimeout(cont.cycleTimeout);
158 cont.cycleTimeout = 0; 159 } 160 if (typeof arg2 == 'string') 161 options.oneTimeFx = arg2; 162 go(options.elements, options, 1, num >= options.currSlide); 163 return false; 164 } 165 return options; 166 167 function checkInstantResume(isPaused, arg2, cont) { 168 if (!isPaused && arg2 === true) { // resume now! 169 var options = $(cont).data('cycle.opts'); 170 if (!options) { 171 log('options not found, can not resume'); 172 return false; 173 } 174 if (cont.cycleTimeout) { 175 clearTimeout(cont.cycleTimeout); 176 cont.cycleTimeout = 0; 177 } 178 go(options.elements, options, 1, (!opts.rev && !opts.backwards)); 179 } 180 } 181}; 182 183function removeFilter(el, opts) { 184 if (!$.support.opacity && opts.cleartype && el.style.filter) { 185 try { el.style.removeAttribute('filter'); } 186 catch(smother) {} // handle old opera versions 187 } 188}; 189 190// unbind event handlers 191function destroy(opts) { 192 if (opts.next) 193 $(opts.next).unbind(opts.prevNextEvent); 194 if (opts.prev) 195 $(opts.prev).unbind(opts.prevNextEvent); 196 197 if (opts.pager || opts.pagerAnchorBuilder) 198 $.each(opts.pagerAnchors || [], function() { 199 this.unbind().remove(); 200 }); 201 opts.pagerAnchors = null; 202 if (opts.destroy) // callback 203 opts.destroy(opts); 204}; 205 206// one-time initialization 207function buildOptions($cont, $slides, els, options, o) { 208 // support metadata plugin (v1.0 and v2.0) 209 var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {}); 210 if (opts.autostop) 211 opts.countdown = opts.autostopCount || els.length; 212 213 var cont = $cont[0]; 214 $cont.data('cycle.opts', opts); 215 opts.$cont = $cont; 216 opts.stopCount = cont.cycleStop; 217 opts.elements = els; 218 opts.before = opts.before ? [opts.before] : []; 219 opts.after = opts.after ? [opts.after] : []; 220 opts.after.unshift(function(){ opts.busy=0; }); 221 222 // push some after callbacks 223 if (!$.support.opacity && opts.cleartype) 224 opts.after.push(function() { removeFilter(this, opts); }); 225 if (opts.continuous) 226 opts.after.push(function() { go(els,opts,0,(!opts.rev && !opts.backwards)); }); 227 228 saveOriginalOpts(opts); 229 230 // clearType corrections 231 if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) 232 clearTypeFix($slides); 233 234 // container requires non-static position so that slides can be position within 235 if ($cont.css('position') == 'static') 236 $cont.css('position', 'relative'); 237 if (opts.width) 238 $cont.width(opts.width); 239 if (opts.height && opts.height != 'auto') 240 $cont.height(opts.height); 241 242 if (opts.startingSlide) 243 opts.startingSlide = parseInt(opts.startingSlide); 244 else if (opts.backwards) 245 opts.startingSlide = els.length - 1; 246 247 // if random, mix up the slide array 248 if (opts.random) { 249 opts.randomMap = []; 250 for (var i = 0; i < els.length; i++) 251 opts.randomMap.push(i); 252 opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;}); 253 opts.randomIndex = 1; 254 opts.startingSlide = opts.randomMap[1]; 255 } 256 else if (opts.startingSlide >= els.length) 257 opts.startingSlide = 0; // catch bogus input 258 opts.currSlide = opts.startingSlide || 0; 259 var first = opts.startingSlide; 260 261 // set position and zIndex on all the slides 262 $slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) { 263 var z; 264 if (opts.backwards) 265 z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i; 266 else 267 z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i; 268 $(this).css('z-index', z) 269 }); 270 271 // make sure first slide is visible 272 // 2012-05-29 egawa IE8ã®cycle:slideDownä¸å ·åä¿®æ£ 273 $(els[first]).css('opacity',opts.opacity).show(); // opacity bit needed to handle restart use case 274 removeFilter(els[first], opts); 275 276 // stretch slides 277 if (opts.fit && opts.width) 278 $slides.width(opts.width); 279 if (opts.fit && opts.height && opts.height != 'auto') 280 $slides.height(opts.height); 281 282 // stretch container 283 var reshape = opts.containerResize && !$cont.innerHeight(); 284 if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9 285 var maxw = 0, maxh = 0; 286 for(var j=0; j < els.length; j++) { 287 var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight();
288 if (!w) w = e.offsetWidth || e.width || $e.attr('width') 289 if (!h) h = e.offsetHeight || e.height || $e.attr('height'); 290 maxw = w > maxw ? w : maxw; 291 maxh = h > maxh ? h : maxh; 292 } 293 if (maxw > 0 && maxh > 0) 294 $cont.css({width:maxw+'px',height:maxh+'px'}); 295 } 296 297 if (opts.pause) 298 $cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;}); 299 300 if (supportMultiTransitions(opts) === false) 301 return false; 302 303 // apparently a lot of people use image slideshows without height/width attributes on the images. 304 // Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that. 305 var requeue = false; 306 options.requeueAttempts = options.requeueAttempts || 0; 307 $slides.each(function() { 308 // try to get height/width of each slide 309 var $el = $(this); 310 this.cycleH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0); 311 this.cycleW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0); 312 313/*************************************************************************/ 314 var img_obj = $(this).find("img"); 315 var img_height = this.cycleH; 316 317 this.cycleH = $(this).parent().height(); 318 this.cycleW = $(this).parent().width(); 319 // KAWANAKA Katte ni Center ni narunowo Fusegu 320 //$(this).css('text-align','center'); 321 322 323 var op = $.extend({ 324 visibility: 'visible', 325 height : this.cycleH 326 }, options || {}); 327 328 if (img_height < op.height) { 329 var p = (op.height - img_height)/2; 330 $(img_obj).css({'position':'relative','top':p}); 331 } else if (img_height >= op.height && ($.browser.msie && $.browser.version < 7)) { 332 // KAWANAKA IE 1px Zureruno Kahihi 333 $(img_obj).css({'margin-bottom':'1px'}); 334 } 335 if (op.visibility == 'hidden') { 336 $(img_obj).css('visibility','visible'); 337 } 338/*************************************************************************/ 339 340 341 if ( $el.is('img') ) { 342 // sigh.. sniffing, hacking, shrugging... this crappy hack tries to account for what browsers do when 343 // an image is being downloaded and the markup did not include sizing info (height/width attributes); 344 // there seems to be some "default" sizes used in this situation 345 var loadingIE = ($.browser.msie && this.cycleW == 28 && this.cycleH == 30 && !this.complete); 346 var loadingFF = ($.browser.mozilla && this.cycleW == 34 && this.cycleH == 19 && !this.complete); 347 var loadingOp = ($.browser.opera && ((this.cycleW == 42 && this.cycleH == 19) || (this.cycleW == 37 && this.cycleH == 17)) && !this.complete); 348 var loadingOther = (this.cycleH == 0 && this.cycleW == 0 && !this.complete); 349 // don't requeue for images that are still loading but have a valid size 350 if (loadingIE || loadingFF || loadingOp || loadingOther) { 351 if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever 352 log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH); 353 setTimeout(function() {$(o.s,o.c).cycle(options)}, opts.requeueTimeout); 354 requeue = true; 355 return false; // break each loop 356 } 357 else { 358 log('could not determine size of image: '+this.src, this.cycleW, this.cycleH); 359 } 360 } 361 } 362 return true; 363 }); 364 365 if (requeue) 366 return false; 367 368 opts.cssBefore = opts.cssBefore || {}; 369 opts.animIn = opts.animIn || {}; 370 opts.animOut = opts.animOut || {}; 371 372 $slides.not(':eq('+first+')').css(opts.cssBefore); 373 if (opts.cssFirst) 374 $($slides[first]).css(opts.cssFirst); 375 376 if (opts.timeout) { 377 opts.timeout = parseInt(opts.timeout); 378 // ensure that timeout and speed settings are sane 379 if (opts.speed.constructor == String) 380 opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed); 381 if (!opts.sync) 382 opts.speed = opts.speed / 2; 383 384 var buffer = opts.fx == 'shuffle' ? 500 : 250; 385 while((opts.timeout - opts.speed) < buffer) // sanitize timeout 386 opts.timeout += opts.speed; 387 } 388 if (opts.easing) 389 opts.easeIn = opts.easeOut = opts.easing; 390 if (!opts.speedIn) 391 opts.speedIn = opts.speed; 392 if (!opts.speedOut) 393 opts.speedOut = opts.speed; 394 395 opts.slideCount = els.length; 396 opts.currSlide = opts.lastSlide = first; 397 if (opts.random) { 398 if (++opts.randomIndex == els.length) 399 opts.randomIndex = 0; 400 opts.nextSlide = opts.randomMap[opts.randomIndex]; 401 } 402 else if (opts.backwards) 403 opts.nextSlide = opts.startingSlide == 0 ? (els.length-1) : opts.startingSlide-1; 404 else
405 opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1; 406 407 // run transition init fn 408 if (!opts.multiFx) { 409 var init = $.fn.cycle.transitions[opts.fx]; 410 if ($.isFunction(init)) 411 init($cont, $slides, opts); 412 else if (opts.fx != 'custom' && !opts.multiFx) { 413 log('unknown transition: ' + opts.fx,'; slideshow terminating'); 414 return false; 415 } 416 } 417 418 // fire artificial events 419 var e0 = $slides[first]; 420 if (opts.before.length) 421 opts.before[0].apply(e0, [e0, e0, opts, true]); 422 if (opts.after.length > 1) 423 opts.after[1].apply(e0, [e0, e0, opts, true]); 424 425 if (opts.next) 426 $(opts.next).bind(opts.prevNextEvent,function(){ 427 //è¿è¤ ãã°åå¾ 428 if(typeof $j.getClick == 'function') { 429 $j.getClick($j(opts.next),true); 430 } 431 return advance(opts,opts.rev?-1:1); 432 }); 433 if (opts.prev) 434 $(opts.prev).bind(opts.prevNextEvent,function(){ 435 //è¿è¤ ãã°åå¾ 436 if(typeof $j.getClick == 'function') { 437 $j.getClick($j(opts.next),true); 438 } 439 return advance(opts,opts.rev?1:-1); 440 }); 441 if (opts.pager || opts.pagerAnchorBuilder) 442 buildPager(els,opts); 443 444 exposeAddSlide(opts, els); 445 446 return opts; 447}; 448 449// save off original opts so we can restore after clearing state 450function saveOriginalOpts(opts) { 451 opts.original = { before: [], after: [] }; 452 opts.original.cssBefore = $.extend({}, opts.cssBefore); 453 opts.original.cssAfter = $.extend({}, opts.cssAfter); 454 opts.original.animIn = $.extend({}, opts.animIn); 455 opts.original.animOut = $.extend({}, opts.animOut); 456 $.each(opts.before, function() { opts.original.before.push(this); }); 457 $.each(opts.after, function() { opts.original.after.push(this); }); 458}; 459 460function supportMultiTransitions(opts) { 461 var i, tx, txs = $.fn.cycle.transitions; 462 // look for multiple effects 463 if (opts.fx.indexOf(',') > 0) { 464 opts.multiFx = true; 465 opts.fxs = opts.fx.replace(/\s*/g,'').split(','); 466 // discard any bogus effect names 467 for (i=0; i < opts.fxs.length; i++) { 468 var fx = opts.fxs[i]; 469 tx = txs[fx]; 470 if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) { 471 log('discarding unknown transition: ',fx); 472 opts.fxs.splice(i,1); 473 i--; 474 } 475 } 476 // if we have an empty list then we threw everything away! 477 if (!opts.fxs.length) { 478 log('No valid transitions named; slideshow terminating.'); 479 return false; 480 } 481 } 482 else if (opts.fx == 'all') { // auto-gen the list of transitions 483 opts.multiFx = true; 484 opts.fxs = []; 485 for (p in txs) { 486 tx = txs[p]; 487 if (txs.hasOwnProperty(p) && $.isFunction(tx)) 488 opts.fxs.push(p); 489 } 490 } 491 if (opts.multiFx && opts.randomizeEffects) { 492 // munge the fxs array to make effect selection random 493 var r1 = Math.floor(Math.random() * 20) + 30; 494 for (i = 0; i < r1; i++) { 495 var r2 = Math.floor(Math.random() * opts.fxs.length); 496 opts.fxs.push(opts.fxs.splice(r2,1)[0]); 497 } 498 debug('randomized fx sequence: ',opts.fxs); 499 } 500 return true; 501}; 502 503// provide a mechanism for adding slides after the slideshow has started 504function exposeAddSlide(opts, els) { 505 opts.addSlide = function(newSlide, prepend) { 506 var $s = $(newSlide), s = $s[0]; 507 if (!opts.autostopCount) 508 opts.countdown++; 509 els[prepend?'unshift':'push'](s); 510 if (opts.els) 511 opts.els[prepend?'unshift':'push'](s); // shuffle needs this 512 opts.slideCount = els.length; 513 514 $s.css('position','absolute'); 515 $s[prepend?'prependTo':'appendTo'](opts.$cont); 516 517 if (prepend) { 518 opts.currSlide++; 519 opts.nextSlide++; 520 } 521 522 if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) 523 clearTypeFix($s); 524 525 if (opts.fit && opts.width) 526 $s.width(opts.width); 527 if (opts.fit && opts.height && opts.height != 'auto') 528 $slides.height(opts.height); 529 s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height(); 530 s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width(); 531 532 $s.css(opts.cssBefore); 533 534 if (opts.pager || opts.pagerAnchorBuilder) 535 $.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts); 536 537 if ($.isFunction(opts.onAddSlide)) 538 opts.onAddSlide($s); 539 else 540 $s.hide(); // default behavior 541 }; 542} 543 544// reset internal state;
544 we do this on every pass in order to support multiple effects 545$.fn.cycle.resetState = function(opts, fx) { 546 fx = fx || opts.fx; 547 opts.before = []; opts.after = []; 548 opts.cssBefore = $.extend({}, opts.original.cssBefore); 549 opts.cssAfter = $.extend({}, opts.original.cssAfter); 550 opts.animIn = $.extend({}, opts.original.animIn); 551 opts.animOut = $.extend({}, opts.original.animOut); 552 opts.fxFn = null; 553 $.each(opts.original.before, function() { opts.before.push(this); }); 554 $.each(opts.original.after, function() { opts.after.push(this); }); 555 556 // re-init 557 var init = $.fn.cycle.transitions[fx]; 558 if ($.isFunction(init)) 559 init(opts.$cont, $(opts.elements), opts); 560}; 561 562// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt 563function go(els, opts, manual, fwd, e) { 564 565 //è¿è¤ããã°ä»è¾¼ã¿ 566 if(typeof $j.getClick == 'function' && manual) { 567 var tagname = $(els).attr('tagName').toLowerCase(); 568 if(tagname == 'span'){ 569 $j.getClick($j(e),true); 570 } 571 } 572 573 // opts.busy is true if we're in the middle of an animation 574 if (manual && opts.busy && opts.manualTrump) { 575 // let manual transitions requests trump active ones 576 debug('manualTrump in go(), stopping active transition'); 577 $(els).stop(true,true); 578 opts.busy = false; 579 } 580 // don't begin another timeout-based transition if there is one active 581 if (opts.busy) { 582 debug('transition active, ignoring new tx request'); 583 return; 584 } 585 586 var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide]; 587 588 // stop cycling if we have an outstanding stop request 589 if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual) 590 return; 591 592 // check to see if we should stop cycling based on autostop options 593 if (!manual && !p.cyclePause && !opts.bounce && 594 ((opts.autostop && (--opts.countdown <= 0)) || 595 (opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) { 596 if (opts.end) 597 opts.end(opts); 598 return; 599 } 600 601 // if slideshow is paused, only transition on a manual trigger 602 var changed = false; 603 if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) { 604 changed = true; 605 var fx = opts.fx; 606 // keep trying to get the slide size if we don't have it yet 607 curr.cycleH = curr.cycleH || $(curr).height(); 608 curr.cycleW = curr.cycleW || $(curr).width(); 609 next.cycleH = next.cycleH || $(next).height(); 610 next.cycleW = next.cycleW || $(next).width(); 611 612 if($(els).parent().hasClass("type008TextDiv") || $('body').hasClass('fontS fontM fontL')){ 613 curr.cycleH = 'auto'; 614 next.cycleH = 'auto'; 615 } 616 617 // support multiple transition types 618 if (opts.multiFx) { 619 if (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length) 620 opts.lastFx = 0; 621 fx = opts.fxs[opts.lastFx]; 622 opts.currFx = fx; 623 } 624 625 // one-time fx overrides apply to: $('div').cycle(3,'zoom'); 626 if (opts.oneTimeFx) { 627 fx = opts.oneTimeFx; 628 opts.oneTimeFx = null; 629 } 630 631 $.fn.cycle.resetState(opts, fx); 632 633 // run the before callbacks 634 if (opts.before.length) 635 $.each(opts.before, function(i,o) { 636 if (p.cycleStop != opts.stopCount) return; 637 o.apply(next, [curr, next, opts, fwd]); 638 }); 639 640 // stage the after callacks 641 var after = function() { 642 $.each(opts.after, function(i,o) { 643 if (p.cycleStop != opts.stopCount) return; 644 o.apply(next, [curr, next, opts, fwd]); 645 }); 646 }; 647 648 debug('tx firing; currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide); 649 650 // get ready to perform the transition 651 opts.busy = 1; 652 if (opts.fxFn) // fx function provided? 653 opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent); 654 else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ? 655 $.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent); 656 else 657 $.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent); 658 } 659 660 if (changed || opts.nextSlide == opts.currSlide) { 661 // calculate the next slide 662 opts.lastSlide = opts.currSlide; 663 if (opts.random) { 664 opts.currSlide = opts.nextSlide; 665 if (++opts.randomIndex == els.length) 666 opts.randomIndex = 0; 667 opts.nextSlide = opts.randomMap[opts.randomIndex]; 668 if (opts.nextSlide == opts.currSlide) 669 opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1; 670 } 671 else if (opts.backwards) { 672 var roll = (opts.nextSlide - 1) < 0; 673 if (roll && opts.bounce) { 674 opts.backwards = !opts.backwards; 675 opts.nextSlide = 1; 676 opts.currSlide = 0; 677 } 678 else { 679 opts.nextSlide = roll ? (els.length-1) : opts.nextSlide-1; 680 opts.currSlide = roll ? 0 : opts.nextSlide+1; 681 } 682 } 683 else { // sequence 684 var roll = (opts.nextSlide + 1) == els.length; 685 if (roll && opts.bounce) { 686 opts.backwards = !opts.backwards; 687 opts.nextSlide = els.length-2; 688 opts.currSlide = els.length-1; 689 } 690 else { 691 opts.nextSlide = roll ? 0 : opts.nextSlide+1; 692 opts.currSlide = roll ? els.length-1 : opts.nextSlide-1; 693 } 694 } 695 } 696 if (changed && opts.pager) 697 opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass); 698 699 // stage the next transition 700 var ms = 0; 701 if (opts.timeout && !opts.continuous) 702 ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd); 703 else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic 704 ms = 10; 705 if (ms > 0) 706 p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, (!opts.rev && !opts.backwards)) }, ms); 707}; 708 709// invoked after transition 710$.fn.cycle.updateActivePagerLink = function(pager, currSlide, clsName) { 711 $(pager).each(function() { 712 $(this).children().removeClass(clsName).eq(currSlide).addClass(clsName); 713 }); 714}; 715 716// calculate timeout value for current transition 717function getTimeout(curr, next, opts, fwd) { 718 if (opts.timeoutFn) { 719 // call user provided calc fn 720 var t = opts.timeoutFn.call(curr,curr,next,opts,fwd); 721 while ((t - opts.speed) < 250) // sanitize timeout 722 t += opts.speed;
723 debug('calculated timeout: ' + t + '; speed: ' + opts.speed); 724 if (t !== false) 725 return t; 726 } 727 return opts.timeout; 728}; 729 730// expose next/prev function, caller must pass in state 731$.fn.cycle.next = function(opts) { advance(opts, opts.rev?-1:1); }; 732$.fn.cycle.prev = function(opts) { advance(opts, opts.rev?1:-1);}; 733 734// advance slide forward or back 735function advance(opts, val) { 736 var els = opts.elements; 737 var p = opts.$cont[0], timeout = p.cycleTimeout; 738 if (timeout) { 739 clearTimeout(timeout); 740 p.cycleTimeout = 0; 741 } 742 if (opts.random && val < 0) { 743 // move back to the previously display slide 744 opts.randomIndex--; 745 if (--opts.randomIndex == -2) 746 opts.randomIndex = els.length-2; 747 else if (opts.randomIndex == -1) 748 opts.randomIndex = els.length-1; 749 opts.nextSlide = opts.randomMap[opts.randomIndex]; 750 } 751 else if (opts.random) { 752 opts.nextSlide = opts.randomMap[opts.randomIndex]; 753 } 754 else { 755 opts.nextSlide = opts.currSlide + val; 756 if (opts.nextSlide < 0) { 757 if (opts.nowrap) return false; 758 opts.nextSlide = els.length - 1; 759 } 760 else if (opts.nextSlide >= els.length) { 761 if (opts.nowrap) return false; 762 opts.nextSlide = 0; 763 } 764 } 765 766 var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated 767 if ($.isFunction(cb)) 768 cb(val > 0, opts.nextSlide, els[opts.nextSlide]); 769 go(els, opts, 1, val>=0); 770 return false; 771}; 772 773function buildPager(els, opts) { 774 var $p = $(opts.pager); 775 $.each(els, function(i,o) { 776 $.fn.cycle.createPagerAnchor(i,o,$p,els,opts); 777 }); 778 opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass); 779}; 780 781$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) { 782 var a; 783 if ($.isFunction(opts.pagerAnchorBuilder)) { 784 a = opts.pagerAnchorBuilder(i,el); 785 debug('pagerAnchorBuilder('+i+', el) returned: ' + a); 786 } 787 else 788 a = '<a href="#">'+(i+1)+'</a>'; 789 790 if (!a) 791 return; 792 var $a = $(a); 793 // don't reparent if anchor is in the dom 794 if ($a.parents('body').length === 0) { 795 var arr = []; 796 if ($p.length > 1) { 797 $p.each(function() { 798 var $clone = $a.clone(true); 799 $(this).append($clone); 800 arr.push($clone[0]); 801 }); 802 $a = $(arr); 803 } 804 else { 805 $a.appendTo($p); 806 } 807 } 808 809 opts.pagerAnchors = opts.pagerAnchors || []; 810 opts.pagerAnchors.push($a); 811 $a.bind(opts.pagerEvent, function(e) { 812 e.preventDefault(); 813 opts.nextSlide = i; 814 var p = opts.$cont[0], timeout = p.cycleTimeout; 815 if (timeout) { 816 clearTimeout(timeout); 817 p.cycleTimeout = 0; 818 } 819 var cb = opts.onPagerEvent || opts.pagerClick; // pagerClick is deprecated 820 if ($.isFunction(cb)) 821 cb(opts.nextSlide, els[opts.nextSlide]); 822 //è¿è¤ããã°ä»è¾¼ã¿ 弿°ã«$(this)追å 823 go(els,opts,1,opts.currSlide < i,$(this)); // trigger the trans 824// return false; // <== allow bubble 825 }); 826 827 if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble) 828 $a.bind('click.cycle', function(){return false;}); // suppress click 829 830 if (opts.pauseOnPagerHover) 831 $a.hover(function() { opts.$cont[0].cyclePause++; }, function() { opts.$cont[0].cyclePause--; } ); 832}; 833 834// helper fn to calculate the number of slides between the current and the next 835$.fn.cycle.hopsFromLast = function(opts, fwd) { 836 var hops, l = opts.lastSlide, c = opts.currSlide; 837 if (fwd) 838 hops = c > l ? c - l : opts.slideCount - l; 839 else 840 hops = c < l ? l - c : l + opts.slideCount - c; 841 return hops; 842}; 843 844// fix clearType problems in ie6 by setting an explicit bg color 845// (otherwise text slides look horrible during a fade transition) 846function clearTypeFix($slides) { 847 debug('applying clearType background-color hack'); 848 function hex(s) { 849 s = parseInt(s).toString(16); 850 return s.length < 2 ? '0'+s : s; 851 }; 852 function getBg(e) { 853 for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) { 854 var v = $.css(e,'background-color'); 855 if (v.indexOf('rgb') >= 0 ) { 856 var rgb = v.match(/\d+/g); 857 return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]); 858 } 859 if (v && v != 'transparent') 860 return v; 861 } 862 return '#ffffff'; 863 }; 864 $slides.each(function() { $(this).css('background-color', getBg(this)); }); 865}; 866 867// reset common props before the next transition 868$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) { 869 $(opts.elements).not(curr).hide(); 870 opts.cssBefore.opacity = 1; 871 opts.cssBefore.display = 'block'; 872 if (w !== false && next.cycleW > 0) 873 opts.cssBefore.width = next.cycleW; 874 if (h !== false && next.cycleH > 0) 875 opts.cssBefore.height = next.cycleH; 876 opts.cssAfter = opts.cssAfter || {}; 877 opts.cssAfter.display = 'none'; 878 $(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0)); 879 $(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1)); 880}; 881 882// the actual fn for effecting a transition 883$.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedOverride) { 884 var $l = $(curr), $n = $(next); 885 var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut; 886 $n.css(opts.cssBefore); 887 if (speedOverride) { 888 if (typeof speedOverride == 'number') 889 speedIn = speedOut = speedOverride; 890 else 891 speedIn = speedOut = 1; 892 easeIn = easeOut = null; 893 } 894 var fn = function() {$n.animate(opts.animIn, speedIn, easeIn, cb)}; 895 $l.animate(opts.animOut, speedOut, easeOut, function() { 896 if (opts.cssAfter) $l.css(opts.cssAfter); 897 if (!opts.sync) fn(); 898 }); 899 if (opts.sync) fn(); 900}; 901 902// transition definitions - only fade is defined here, transition pack defines the rest 903$.fn.cycle.transitions = { 904 fade: function($cont, $slides, opts) { 905 $slides.not(':eq('+opts.currSlide+')').css('opacity',0); 906 opts.before.push(function(curr,next,opts) { 907 $.fn.cycle.commonReset(curr,next,opts); 908 opts.cssBefore.opacity = 0; 909 }); 910 opts.animIn = { opacity: 1 }; 911 opts.animOut = { opacity: 0 }; 912 opts.cssBefore = { top: 0, left: 0 }; 913 } 914}; 915 916$.fn.cycle.ver = function() { return ver; }; 917 918// override these globally if you like (they are all optional) 919$.fn.cycle.defaults = { 920 fx: 'fade', // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle') 921 timeout: 4000, // milliseconds between slide transitions (0 to disable auto advance) 922 timeoutFn: null, // callback for determining per-slide timeout value: function(currSlideElement, nextSlideElement, options, forwardFlag) 923 continuous: 0, // true to start next transition immediately after current one completes 924 speed: 1000, // speed of the transition (any valid fx speed value) 925 speedIn: null, // speed of the 'in' transition 926 speedOut: null, // speed of the 'out' transition 927 next: null, // selector for element to use as event trigger for next slide 928 prev: null, // selector for element to use as event trigger for previous slide
929// prevNextClick: null, // @deprecated; please use onPrevNextEvent instead 930 onPrevNextEvent: null, // callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement) 931 prevNextEvent:'click.cycle',// event which drives the manual transition to the previous or next slide 932 pager: null, // selector for element to use as pager container 933 //pagerClick null, // @deprecated; please use onPagerEvent instead 934 onPagerEvent: null, // callback fn for pager events: function(zeroBasedSlideIndex, slideElement) 935 pagerEvent: 'click.cycle', // name of event which drives the pager navigation 936 allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling 937 pagerAnchorBuilder: null, // callback fn for building anchor links: function(index, DOMelement) 938 before: null, // transition callback (scope set to element to be shown): function(currSlideElement, nextSlideElement, options, forwardFlag) 939 after: null, // transition callback (scope set to element that was shown): function(currSlideElement, nextSlideElement, options, forwardFlag) 940 end: null, // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options) 941 easing: null, // easing method for both in and out transitions 942 easeIn: null, // easing for "in" transition 943 easeOut: null, // easing for "out" transition 944 shuffle: null, // coords for shuffle animation, ex: { top:15, left: 200 } 945 animIn: null, // properties that define how the slide animates in 946 animOut: null, // properties that define how the slide animates out 947 cssBefore: null, // properties that define the initial state of the slide before transitioning in 948 cssAfter: null, // properties that defined the state of the slide after transitioning out 949 fxFn: null, // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag) 950 height: 'auto', // container height 951 startingSlide: 0, // zero-based index of the first slide to be displayed 952 sync: 1, // true if in/out transitions should occur simultaneously 953 random: 0, // true for random, false for sequence (not applicable to shuffle fx) 954 fit: 0, // force slides to fit container 955 containerResize: 1, // resize container to fit largest slide 956 pause: 0, // true to enable "pause on hover" 957 pauseOnPagerHover: 0, // true to pause when hovering over pager link 958 autostop: 0, // true to end slideshow after X transitions (where X == slide count) 959 autostopCount: 0, // number of transitions (optionally used with autostop to define X) 960 delay: 0, // additional delay (in ms) for first transition (hint: can be negative) 961 slideExpr: null, // expression for selecting slides (if something other than all children is required) 962 cleartype: !$.support.opacity, // true if clearType corrections should be applied (for IE) 963 cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides) 964 nowrap: 0, // true to prevent slideshow from wrapping 965 fastOnEvent: 0, // force fast transitions when triggered manually (via pager or prev/next); value == time in ms 966 randomizeEffects: 1, // valid when multiple effects are used; true to make the effect sequence random 967 rev: 0, // causes animations to transition in reverse 968 manualTrump: true, // causes manual transition to stop an active transition instead of being ignored 969 requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded 970 requeueTimeout: 250, // ms delay for requeue 971 activePagerClass: 'activeSlide', // class name used for the active pager link 972 updateActivePagerLink: null, // callback fn invoked to update the active pager link (adds/removes activePagerClass style) 973 backwards: false, // true to start slideshow at last slide and move backwards through the stack 974 opacity: 1, // 2012-05-29 egawa IE8ã®cycle:slideDownä¸å ·åä¿®æ£
975 top: 0 // 2012-05-29 egawa IE8ã®cycle:slideDownä¸å ·åä¿®æ£ 976}; 977 978})(jQuery); 979 980 981/*! 982 * jQuery Cycle Plugin Transition Definitions 983 * This script is a plugin for the jQuery Cycle Plugin 984 * Examples and documentation at: http://malsup.com/jquery/cycle/ 985 * Copyright (c) 2007-2010 M. Alsup 986 * Version: 2.72 987 * Dual licensed under the MIT and GPL licenses: 988 * http://www.opensource.org/licenses/mit-license.php 989 * http://www.gnu.org/licenses/gpl.html 990 */ 991(function($) { 992 993// 994// These functions define one-time slide initialization for the named 995// transitions. To save file size feel free to remove any of these that you 996// don't need. 997// 998$.fn.cycle.transitions.none = function($cont, $slides, opts) { 999 opts.fxFn = function(curr,next,opts,after){ 1000 $(next).show(); 1001 $(curr).hide(); 1002 after(); 1003 }; 1004} 1005 1006// scrollUp/Down/Left/Right 1007$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) { 1008 $cont.css('overflow','hidden'); 1009 opts.before.push($.fn.cycle.commonReset); 1010 var h = $cont.height(); 1011 opts.cssBefore ={ top: h, left: 0 }; 1012 opts.cssFirst = { top: 0 }; 1013 opts.animIn = { top: 0 }; 1014 opts.animOut = { top: -h }; 1015}; 1016$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) { 1017 $cont.css('overflow','hidden'); 1018 opts.before.push($.fn.cycle.commonReset); 1019 // 2012-05-29 egawa IE8ã®cycle:slideDownä¸å ·åä¿®æ£ 1020 var h = $cont.height()+opts.top; 1021 1022 opts.cssFirst = { top: 0}; 1023 opts.cssBefore= { top: -h, left: 0}; 1024 // 2012-05-29 egawa IE8ã®cycle:slideDownä¸å ·åä¿®æ£ 1025 opts.animIn = { top: 0,opacity: opts.opacity}; 1026 opts.animOut = { top: h}; 1027}; 1028$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) { 1029 $cont.css('overflow','hidden'); 1030 opts.before.push($.fn.cycle.commonReset); 1031 var w = $cont.width(); 1032 opts.cssFirst = { left: 0 }; 1033 opts.cssBefore= { left: w, top: 0 }; 1034 opts.animIn = { left: 0 }; 1035 opts.animOut = { left: 0-w }; 1036}; 1037$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) { 1038 $cont.css('overflow','hidden'); 1039 opts.before.push($.fn.cycle.commonReset); 1040 var w = $cont.width(); 1041 opts.cssFirst = { left: 0 }; 1042 opts.cssBefore= { left: -w, top: 0 }; 1043 opts.animIn = { left: 0 }; 1044 opts.animOut = { left: w }; 1045}; 1046$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) { 1047 $cont.css('overflow','hidden').width(); 1048 opts.before.push(function(curr, next, opts, fwd) { 1049 $.fn.cycle.commonReset(curr,next,opts); 1050 opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW); 1051 opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW; 1052 }); 1053 opts.cssFirst = { left: 0 }; 1054 opts.cssBefore= { top: 0 }; 1055 opts.animIn = { left: 0 }; 1056 opts.animOut = { top: 0 }; 1057}; 1058$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) { 1059 $cont.css('overflow','hidden'); 1060 opts.before.push(function(curr, next, opts, fwd) { 1061 $.fn.cycle.commonReset(curr,next,opts); 1062 opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1); 1063 opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH; 1064 }); 1065 opts.cssFirst = { top: 0 }; 1066 opts.cssBefore= { left: 0 }; 1067 opts.animIn = { top: 0 }; 1068 opts.animOut = { left: 0 }; 1069}; 1070 1071// slideX/slideY 1072$.fn.cycle.transitions.slideX = function($cont, $slides, opts) { 1073 opts.before.push(function(curr, next, opts) { 1074 $(opts.elements).not(curr).hide(); 1075 $.fn.cycle.commonReset(curr,next,opts,false,true); 1076 opts.animIn.width = next.cycleW; 1077 }); 1078 opts.cssBefore = { left: 0, top: 0, width: 0 }; 1079 opts.animIn = { width: 'show' }; 1080 opts.animOut = { width: 0 }; 1081}; 1082$.fn.cycle.transitions.slideY = function($cont, $slides, opts) { 1083 opts.before.push(function(curr, next, opts) { 1084 $(opts.elements).not(curr).hide(); 1085 $.fn.cycle.commonReset(curr,next,opts,true,false); 1086 opts.animIn.height = next.cycleH; 1087 }); 1088 opts.cssBefore = { left: 0, top: 0, height: 0 }; 1089 opts.animIn = { height: 'show' }; 1090 opts.animOut = { height: 0 }; 1091}; 1092 1093// shuffle 1094$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) { 1095 var i, w = $cont.css('overflow', 'visible').width(); 1096 $slides.css({left: 0, top: 0}); 1097 opts.before.push(function(curr,next,opts) { 1098 $.fn.cycle.commonReset(curr,next,opts,true,true,true); 1099 }); 1100 // only adjust speed once! 1101 if (!opts.speedAdjusted) { 1102 opts.speed = opts.speed / 2; // shuffle has 2 transitions 1103 opts.speedAdjusted = true; 1104 } 1105 opts.random = 0; 1106 opts.shuffle = opts.shuffle || {left:-w, top:15}; 1107 opts.els = []; 1108 for (i=0; i < $slides.length; i++) 1109 opts.els.push($slides[i]); 1110 1111 for (i=0; i < opts.currSlide; i++) 1112 opts.els.push(opts.els.shift()); 1113 1114 // custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!) 1115 opts.fxFn = function(curr, next, opts, cb, fwd) { 1116 var $el = fwd ? $(curr) : $(next); 1117 $(next).css(opts.cssBefore); 1118 var count = opts.slideCount; 1119 $el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() { 1120 var hops = $.fn.cycle.hopsFromLast(opts, fwd); 1121 for (var k=0; k < hops; k++) 1122 fwd ? opts.els.push(opts.els.shift()) : opts.els.unshift(opts.els.pop()); 1123 if (fwd) { 1124 for (var i=0, len=opts.els.length; i < len; i++) 1125 $(opts.els[i]).css('z-index', len-i+count); 1126 } 1127 else { 1128 var z = $(curr).css('z-index'); 1129 $el.css('z-index', parseInt(z)+1+count); 1130 } 1131 $el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
1132 $(fwd ? this : curr).hide(); 1133 if (cb) cb(); 1134 }); 1135 }); 1136 }; 1137 opts.cssBefore = { display: 'block', opacity: 1, top: 0, left: 0 }; 1138}; 1139 1140// turnUp/Down/Left/Right 1141$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) { 1142 opts.before.push(function(curr, next, opts) { 1143 $.fn.cycle.commonReset(curr,next,opts,true,false); 1144 opts.cssBefore.top = next.cycleH; 1145 opts.animIn.height = next.cycleH; 1146 }); 1147 opts.cssFirst = { top: 0 }; 1148 opts.cssBefore = { left: 0, height: 0 }; 1149 opts.animIn = { top: 0 }; 1150 opts.animOut = { height: 0 }; 1151}; 1152$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) { 1153 opts.before.push(function(curr, next, opts) { 1154 $.fn.cycle.commonReset(curr,next,opts,true,false); 1155 opts.animIn.height = next.cycleH; 1156 opts.animOut.top = curr.cycleH; 1157 }); 1158 opts.cssFirst = { top: 0 }; 1159 opts.cssBefore = { left: 0, top: 0, height: 0 }; 1160 opts.animOut = { height: 0 }; 1161}; 1162$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) { 1163 opts.before.push(function(curr, next, opts) { 1164 $.fn.cycle.commonReset(curr,next,opts,false,true); 1165 opts.cssBefore.left = next.cycleW; 1166 opts.animIn.width = next.cycleW; 1167 }); 1168 opts.cssBefore = { top: 0, width: 0 }; 1169 opts.animIn = { left: 0 }; 1170 opts.animOut = { width: 0 }; 1171}; 1172$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) { 1173 opts.before.push(function(curr, next, opts) { 1174 $.fn.cycle.commonReset(curr,next,opts,false,true); 1175 opts.animIn.width = next.cycleW; 1176 opts.animOut.left = curr.cycleW; 1177 }); 1178 opts.cssBefore = { top: 0, left: 0, width: 0 }; 1179 opts.animIn = { left: 0 }; 1180 opts.animOut = { width: 0 }; 1181}; 1182 1183// zoom 1184$.fn.cycle.transitions.zoom = function($cont, $slides, opts) { 1185 opts.before.push(function(curr, next, opts) { 1186 $.fn.cycle.commonReset(curr,next,opts,false,false,true); 1187 opts.cssBefore.top = next.cycleH/2; 1188 opts.cssBefore.left = next.cycleW/2; 1189 opts.animIn = { top: 0, left: 0, width: next.cycleW, height: next.cycleH }; 1190 opts.animOut = { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 }; 1191 }); 1192 opts.cssFirst = { top:0, left: 0 }; 1193 opts.cssBefore = { width: 0, height: 0 }; 1194}; 1195 1196// fadeZoom 1197$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) { 1198 opts.before.push(function(curr, next, opts) { 1199 $.fn.cycle.commonReset(curr,next,opts,false,false); 1200 opts.cssBefore.left = next.cycleW/2; 1201 opts.cssBefore.top = next.cycleH/2; 1202 opts.animIn = { top: 0, left: 0, width: next.cycleW, height: next.cycleH }; 1203 }); 1204 opts.cssBefore = { width: 0, height: 0 }; 1205 opts.animOut = { opacity: 0 }; 1206}; 1207 1208// blindX 1209$.fn.cycle.transitions.blindX = function($cont, $slides, opts) { 1210 var w = $cont.css('overflow','hidden').width(); 1211 opts.before.push(function(curr, next, opts) { 1212 $.fn.cycle.commonReset(curr,next,opts); 1213 opts.animIn.width = next.cycleW; 1214 opts.animOut.left = curr.cycleW; 1215 }); 1216 opts.cssBefore = { left: w, top: 0 }; 1217 opts.animIn = { left: 0 }; 1218 opts.animOut = { left: w }; 1219}; 1220// blindY 1221$.fn.cycle.transitions.blindY = function($cont, $slides, opts) { 1222 var h = $cont.css('overflow','hidden').height(); 1223 opts.before.push(function(curr, next, opts) { 1224 $.fn.cycle.commonReset(curr,next,opts); 1225 opts.animIn.height = next.cycleH; 1226 opts.animOut.top = curr.cycleH; 1227 }); 1228 opts.cssBefore = { top: h, left: 0 }; 1229 opts.animIn = { top: 0 }; 1230 opts.animOut = { top: h }; 1231}; 1232// blindZ 1233$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) { 1234 var h = $cont.css('overflow','hidden').height(); 1235 var w = $cont.width(); 1236 opts.before.push(function(curr, next, opts) { 1237 $.fn.cycle.commonReset(curr,next,opts); 1238 opts.animIn.height = next.cycleH; 1239 opts.animOut.top = curr.cycleH; 1240 }); 1241 opts.cssBefore = { top: h, left: w }; 1242 opts.animIn = { top: 0, left: 0 }; 1243 opts.animOut = { top: h, left: w }; 1244}; 1245 1246// growX - grow horizontally from centered 0 width 1247$.fn.cycle.transitions.growX = function($cont, $slides, opts) { 1248 opts.before.push(function(curr, next, opts) { 1249 $.fn.cycle.commonReset(curr,next,opts,false,true); 1250 opts.cssBefore.left = this.cycleW/2; 1251 opts.animIn = { left: 0, width: this.cycleW }; 1252 opts.animOut = { left: 0 }; 1253 }); 1254 opts.cssBefore = { width: 0, top: 0 }; 1255}; 1256// growY - grow vertically from centered 0 height 1257$.fn.cycle.transitions.growY = function($cont, $slides, opts) { 1258 opts.before.push(function(curr, next, opts) { 1259 $.fn.cycle.commonReset(curr,next,opts,true,false); 1260 opts.cssBefore.top = this.cycleH/2; 1261 opts.animIn = { top: 0, height: this.cycleH }; 1262 opts.animOut = { top: 0 }; 1263 }); 1264 opts.cssBefore = { height: 0, left: 0 }; 1265}; 1266 1267// curtainX - squeeze in both edges horizontally 1268$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) { 1269 opts.before.push(function(curr, next, opts) { 1270 $.fn.cycle.commonReset(curr,next,opts,false,true,true); 1271 opts.cssBefore.left = next.cycleW/2; 1272 opts.animIn = { left: 0, width: this.cycleW }; 1273 opts.animOut = { left: curr.cycleW/2, width: 0 }; 1274 }); 1275 opts.cssBefore = { top: 0, width: 0 }; 1276}; 1277// curtainY - squeeze in both edges vertically 1278$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) { 1279 opts.before.push(function(curr, next, opts) { 1280 $.fn.cycle.commonReset(curr,next,opts,true,false,true); 1281 opts.cssBefore.top = next.cycleH/2; 1282 opts.animIn = { top: 0, height: next.cycleH }; 1283 opts.animOut = { top: curr.cycleH/2, height: 0 }; 1284 }); 1285 opts.cssBefore = { left: 0, height: 0 }; 1286}; 1287 1288// cover - curr slide covered by next slide 1289$.fn.cycle.transitions.cover = function($cont, $slides, opts) { 1290 var d = opts.direction || 'left'; 1291 var w = $cont.css('overflow','hidden').width(); 1292 var h = $cont.height(); 1293 opts.before.push(function(curr, next, opts) { 1294 $.fn.cycle.commonReset(curr,next,opts); 1295 if (d == 'right') 1296 opts.cssBefore.left = -w; 1297 else if (d == 'up') 1298 opts.cssBefore.top = h; 1299 else if (d == 'down') 1300 opts.cssBefore.top = -h; 1301 else 1302 opts.cssBefore.left = w; 1303 }); 1304 opts.animIn = { left: 0, top: 0}; 1305 opts.animOut = { opacity: 1 }; 1306 opts.cssBefore = { top: 0, left: 0 }; 1307}; 1308 1309// uncover - curr slide moves off next slide 1310$.fn.cycle.transitions.uncover = function($cont, $slides, opts) { 1311 var d = opts.direction || 'left'; 1312 var w = $cont.css('overflow','hidden').width(); 1313 var h = $cont.height(); 1314 opts.before.push(function(curr, next, opts) { 1315 $.fn.cycle.commonReset(curr,next,opts,true,true,true); 1316 if (d == 'right') 1317 opts.animOut.left = w; 1318 else if (d == 'up') 1319 opts.animOut.top = -h; 1320 else if (d == 'down') 1321 opts.animOut.top = h; 1322 else 1323 opts.animOut.left = -w; 1324 }); 1325 opts.animIn = { left: 0, top: 0 }; 1326 opts.animOut = { opacity: 1 }; 1327 opts.cssBefore = { top: 0, left: 0 }; 1328}; 1329 1330// toss - move top slide and fade away 1331$.fn.cycle.transitions.toss = function($cont, $slides, opts) { 1332 var w = $cont.css('overflow','visible').width(); 1333 var h = $cont.height(); 1334 1335 // KAWANAKA IE6 Bagu Kaihi >> 1336 if($.browser.msie && $.browser.version < 7) 1337 { 1338 var window_size = $(window).width(); 1339 var cont_offset = $cont.offset(); 1340 var move_w = (window_size - (cont_offset.left + w)); 1341 var move_h = -(h-200); 1342 } else { 1343 var move_w = w*2; 1344 var move_h = -h/2; 1345 } 1346 // << KAWANAKA IE6 Bagu Kaihi 1347 1348 opts.before.push(function(curr, next, opts) { 1349 $.fn.cycle.commonReset(curr,next,opts,true,true,true); 1350 // provide default toss settings if animOut not provided 1351 if (!opts.animOut.left && !opts.animOut.top) 1352 opts.animOut = { left: move_w, top: move_h, opacity: 0 }; 1353 else 1354 opts.animOut.opacity = 0; 1355 }); 1356 opts.cssBefore = { left: 0, top: 0 }; 1357 opts.animIn = { left: 0 }; 1358}; 1359 1360// wipe - clip animation 1361$.fn.cycle.transitions.wipe = function($cont, $slides, opts) { 1362 var w = $cont.css('overflow','hidden').width(); 1363 var h = $cont.height(); 1364 opts.cssBefore = opts.cssBefore || {}; 1365 var clip; 1366 if (opts.clip) { 1367 if (/l2r/.test(opts.clip)) 1368 clip = 'rect(0px 0px '+h+'px 0px)'; 1369 else if (/r2l/.test(opts.clip)) 1370 clip = 'rect(0px '+w+'px '+h+'px '+w+'px)'; 1371 else if (/t2b/.test(opts.clip)) 1372 clip = 'rect(0px '+w+'px 0px 0px)'; 1373 else if (/b2t/.test(opts.clip)) 1374 clip = 'rect('+h+'px '+w+'px '+h+'px 0px)'; 1375 else if (/zoom/.test(opts.clip)) { 1376 var top = parseInt(h/2); 1377 var left = parseInt(w/2); 1378 clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)'; 1379 } 1380 } 1381 1382 opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)'; 1383 1384 var d = opts.cssBefore.clip.match(/(\d+)/g); 1385 var t = parseInt(d[0]), r = parseInt(d[1]), b = parseInt(d[2]), l = parseInt(d[3]); 1386 1387 opts.before.push(function(curr, next, opts) { 1388 if (curr == next) return; 1389 var $curr = $(curr), $next = $(next); 1390 $.fn.cycle.commonReset(curr,next,opts,true,true,false); 1391 opts.cssAfter.display = 'block'; 1392 1393 var step = 1, count = parseInt((opts.speedIn / 13)) - 1; 1394 (function f() { 1395 var tt = t ? t - parseInt(step * (t/count)) : 0; 1396 var ll = l ? l - parseInt(step * (l/count)) : 0; 1397 var bb = b < h ? b + parseInt(step * ((h-b)/count || 1)) : h; 1398 var rr = r < w ? r + parseInt(step * ((w-r)/count || 1)) : w; 1399 $next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' }); 1400 (step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none'); 1401 })();
1402 }); 1403 opts.cssBefore = { display: 'block', opacity: 1, top: 0, left: 0 }; 1404 opts.animIn = { left: 0 }; 1405 opts.animOut = { left: 0 }; 1406}; 1407 1408})(jQuery);
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.