22 * jQuery Cycle Lite Plugin
33 * http://malsup.com/jquery/cycle/lite/
44 * Copyright (c) 2008-2012 M. Alsup
5- * Version: 1.6 (02-MAY-2012 )
5+ * Version: 1.7 (20-FEB-2013 )
66 * Dual licensed under the MIT and GPL licenses:
77 * http://www.opensource.org/licenses/mit-license.php
88 * http://www.gnu.org/licenses/gpl.html
1111; ( function ( $ ) {
1212"use strict" ;
1313
14- var ver = 'Lite-1.6' ;
14+ var ver = 'Lite-1.7' ;
15+ var msie = / M S I E / . test ( navigator . userAgent ) ;
1516
1617$ . fn . cycle = function ( options ) {
1718 return this . each ( function ( ) {
1819 options = options || { } ;
19-
20- if ( this . cycleTimeout ) clearTimeout ( this . cycleTimeout ) ;
20+
21+ if ( this . cycleTimeout )
22+ clearTimeout ( this . cycleTimeout ) ;
2123
2224 this . cycleTimeout = 0 ;
2325 this . cyclePause = 0 ;
24-
26+
2527 var $cont = $ ( this ) ;
2628 var $slides = options . slideExpr ? $ ( options . slideExpr , this ) : $cont . children ( ) ;
2729 var els = $slides . get ( ) ;
@@ -36,43 +38,44 @@ $.fn.cycle = function(options) {
3638 var meta = $ . isFunction ( $cont . data ) ? $cont . data ( opts . metaAttr ) : null ;
3739 if ( meta )
3840 opts = $ . extend ( opts , meta ) ;
39-
41+
4042 opts . before = opts . before ? [ opts . before ] : [ ] ;
4143 opts . after = opts . after ? [ opts . after ] : [ ] ;
4244 opts . after . unshift ( function ( ) { opts . busy = 0 ; } ) ;
43-
45+
4446 // allow shorthand overrides of width, height and timeout
4547 var cls = this . className ;
4648 opts . width = parseInt ( ( cls . match ( / w : ( \d + ) / ) || [ ] ) [ 1 ] , 10 ) || opts . width ;
4749 opts . height = parseInt ( ( cls . match ( / h : ( \d + ) / ) || [ ] ) [ 1 ] , 10 ) || opts . height ;
4850 opts . timeout = parseInt ( ( cls . match ( / t : ( \d + ) / ) || [ ] ) [ 1 ] , 10 ) || opts . timeout ;
4951
50- if ( $cont . css ( 'position' ) == 'static' )
52+ if ( $cont . css ( 'position' ) == 'static' )
5153 $cont . css ( 'position' , 'relative' ) ;
52- if ( opts . width )
54+ if ( opts . width )
5355 $cont . width ( opts . width ) ;
54- if ( opts . height && opts . height != 'auto' )
56+ if ( opts . height && opts . height != 'auto' )
5557 $cont . height ( opts . height ) ;
5658
5759 var first = 0 ;
5860 $slides . css ( { position : 'absolute' , top :0 } ) . each ( function ( i ) {
5961 $ ( this ) . css ( 'z-index' , els . length - i ) ;
6062 } ) ;
61-
63+
6264 $ ( els [ first ] ) . css ( 'opacity' , 1 ) . show ( ) ; // opacity bit needed to handle reinit case
63- if ( $ . browser . msie ) els [ first ] . style . removeAttribute ( 'filter' ) ;
65+ if ( msie )
66+ els [ first ] . style . removeAttribute ( 'filter' ) ;
6467
65- if ( opts . fit && opts . width )
68+ if ( opts . fit && opts . width )
6669 $slides . width ( opts . width ) ;
67- if ( opts . fit && opts . height && opts . height != 'auto' )
70+ if ( opts . fit && opts . height && opts . height != 'auto' )
6871 $slides . height ( opts . height ) ;
69- if ( opts . pause )
72+ if ( opts . pause )
7073 $cont . hover ( function ( ) { this . cyclePause = 1 ; } , function ( ) { this . cyclePause = 0 ; } ) ;
7174
7275 var txFn = $ . fn . cycle . transitions [ opts . fx ] ;
7376 if ( txFn )
7477 txFn ( $cont , $slides , opts ) ;
75-
78+
7679 $slides . each ( function ( ) {
7780 var $el = $ ( this ) ;
7881 this . cycleH = ( opts . fit && opts . height ) ? opts . height : $el . height ( ) ;
@@ -104,7 +107,7 @@ $.fn.cycle = function(options) {
104107 opts . before [ 0 ] . apply ( e0 , [ e0 , e0 , opts , true ] ) ;
105108 if ( opts . after . length > 1 )
106109 opts . after [ 1 ] . apply ( e0 , [ e0 , e0 , opts , true ] ) ;
107-
110+
108111 if ( opts . click && ! opts . next )
109112 opts . next = opts . click ;
110113 if ( opts . next )
@@ -120,17 +123,17 @@ $.fn.cycle = function(options) {
120123} ;
121124
122125function go ( els , opts , manual , fwd ) {
123- if ( opts . busy )
126+ if ( opts . busy )
124127 return ;
125128 var p = els [ 0 ] . parentNode , curr = els [ opts . currSlide ] , next = els [ opts . nextSlide ] ;
126- if ( p . cycleTimeout === 0 && ! manual )
129+ if ( p . cycleTimeout === 0 && ! manual )
127130 return ;
128131
129132 if ( manual || ! p . cyclePause ) {
130133 if ( opts . before . length )
131134 $ . each ( opts . before , function ( i , o ) { o . apply ( next , [ curr , next , opts , fwd ] ) ; } ) ;
132135 var after = function ( ) {
133- if ( $ . browser . msie )
136+ if ( msie )
134137 this . style . removeAttribute ( 'filter' ) ;
135138 $ . each ( opts . after , function ( i , o ) { o . apply ( next , [ curr , next , opts , fwd ] ) ; } ) ;
136139 queueNext ( opts ) ;
@@ -229,4 +232,4 @@ $.fn.cycle.defaults = {
229232 timeout : 4000
230233} ;
231234
232- } ) ( jQuery ) ;
235+ } ) ( jQuery ) ;
0 commit comments