PageSourceSearch

https://www.cheapjordansonlinesale.com/includes/templates/xiaoxue/jscript/jscript_jquery.zanythingslider.js

js cheapjordansonlinesale.com collected 2026-10-08 07:46:23 UTC 10,001 bytes, 305 lines download raw bytes

1/*
2    anythingSlider v1.2
3    
4    By Chris Coyier: http://css-tricks.com
5    with major improvements by Doug Neiner: http://pixelgraphics.us/
6    based on work by Remy Sharp: http://jqueryfordesigners.com/
7
8
9	To use the navigationFormatter function, you must have a function that
10	accepts two paramaters, and returns a string of HTML text.
11	
12	index = integer index (1 based);
13	panel = jQuery wrapped LI item this tab references
14	@return = Must return a string of HTML/Text
15	
16	navigationFormatter: function(index, panel){
17		return index + " Panel"; // This would have each tab with the text 'X Panel' where X = index
18	}
19*/
20
21(function($){
22	
23    $.anythingSlider = function(el, options){
24        // To avoid scope issues, use 'base' instead of 'this'
25        // to reference this class from internal events and functions.
26        var base = this;
27        
28        // Access to jQuery and DOM versions of element
29        base.$el = $(el);
30        base.el = el; 
31
32		// Set up a few defaults
33        base.currentPage = 1;
34		base.timer = null;
35		base.playing = false;
36
37        // Add a reverse reference to the DOM object
38        base.$el.data("AnythingSlider", base);
39        
40        base.init = function(){
41            base.options = $.extend({},$.anythingSlider.defaults, options);
42			
43			// Cache existing DOM elements for later 
44			base.$wrapper = base.$el.find('> div').css('overflow', 'hidden');
45            base.$slider  = base.$wrapper.find('> ul');
46            base.$items   = base.$slider.find('> li');
47            base.$single  = base.$items.filter(':first');
48
49			// Build the navigation if needed
50			if(base.options.buildNavigation) base.buildNavigation();
51        
52        	// Get the details
53            base.singleWidth = base.$single.outerWidth();
54            base.pages = base.$items.length;
55
56            // Top and tail the list with 'visible' number of items, top has the last section, and tail has the first
57			// This supports the "infinite" scrolling
58			base.$items.filter(':first').before(base.$items.filter(':last').clone().addClass('cloned'));
59            base.$items.filter(':last' ).after(base.$items.filter(':first').clone().addClass('cloned'));
60
61			// We just added two items, time to re-cache the list
62            base.$items = base.$slider.find('> li'); // reselect
63            
64			// Setup our forward/backward navigation
65			base.buildNextBackButtons();
66		
67			// If autoPlay functionality is included, then initialize the settings
68			if(base.options.autoPlay) {
69				base.playing = !base.options.startStopped; // Sets the playing variable to false if startStopped is true
70				base.buildAutoPlay();
71			};
72			
73			// If pauseOnHover then add hover effects
74			if(base.options.pauseOnHover) {
75				base.$el.hover(function(){
76					base.clearTimer();
77				}, function(){
78					base.startStop(base.playing);
79				});
80			}
81			
82			// If a hash can not be used to trigger the plugin, then go to page 1
83			if((base.options.hashTags == true && !base.gotoHash()) || base.options.hashTags == false){
84				base.setCurrentPage(1);
85			};
86        };
87
88		base.gotoPage = function(page, autoplay){
89			// When autoplay isn't passed, we stop the timer
90			if(autoplay !== true) autoplay = false;
91			if(!autoplay) base.startStop(false);
92			
93			if(typeof(page) == "undefined" || page == null) {
94				page = 1;
95				base.setCurrentPage(1);
96			};
97			
98			// Just check for bounds
99			if(page > base.pages + 1) page = base.pages;
100			if(page < 0 ) page = 1;
101
102			var dir = page < base.currentPage ? -1 : 1,
103                n = Math.abs(base.currentPage - page),
104                left = base.singleWidth * dir * n;
105			
106			base.$wrapper.filter(':not(:animated)').animate({
107                scrollLeft : '+=' + left
108            }, base.options.animationTime, base.options.easing, function () {
109                if (page == 0) {
110                    base.$wrapper.scrollLeft(base.singleWidth * base.pages);
111					page = base.pages;
112                } else if (page > base.pages) {
113                    base.$wrapper.scrollLeft(base.singleWidth);
114                    // reset back to start position
115                    page = 1;
116                };
117				base.setCurrentPage(page);
118				
119            });
120		};
121		
122		base.setCurrentPage = function(page, move){
123			// Set visual
124			if(base.options.buildNavigation){
125				base.$nav.find('.cur').removeClass('cur');
126				$(base.$navLinks[page - 1]).addClass('cur');	
127			};
128			
129			// Only change left if move does not equal false
130			if(move !== false) base.$wrapper.scrollLeft(base.singleWidth * page);
131
132			// Update local variable
133			base.currentPage = page;
134		};
135		
136		base.goForward = function(autoplay){
137			if(autoplay !== true) autoplay = false;
138			base.gotoPage(base.currentPage + 1, autoplay);
139		};
140		
141		base.goBack = function(){
142			base.gotoPage(base.currentPage - 1);
143		};
144		
145		// This method tries to find a hash that matches panel-X
146		// If found, it tries to find a matching item
147		// If that is found as well, then that item starts visible
148		base.gotoHash = function(){
149			if(/^#?panel-\d+$/.test(window.location.hash)){
150				var index = parseInt(window.location.hash.substr(7));
151				var $item = base.$items.filter(':eq(' + index + ')');
152				if($item.length != 0){
153					base.setCurrentPage(index);
154					return true;
155				};
156			};
157			return false; // A item wasn't found;
158		};
159        
160		// Creates the numbered navigation links
161		base.buildNavigation = function(){
162			base.$nav = $("<div id='thumbNav'></div>").appendTo(base.$el);
163			base.$items.each(function(i,el){
164				var index = i + 1;
165				var $a = $("<a href='#'></a>");
166				
167				// If a formatter function is present, use it
168				if( typeof(base.options.navigationFormatter) == "function"){
169					$a.html(base.options.navigationFormatter(index, $(this)));
170				} else {
171					$a.text(index);
172				}
173				$a.click(function(e){
174                    base.gotoPage(index);
175                    
176                    if (base.options.hashTags)
177						base.setHash('panel-' + index);
178						
179                    e.preventDefault();
180				});
181				base.$nav.append($a);
182			});
183			base.$navLinks = base.$nav.find('> a');
184		};
185		
186		
187		// Creates the Forward/Backward buttons
188		base.buildNextBackButtons = function(){
189			var $forward = $('<a class="arrow forward">&gt;</a>'),
190				$back    = $('<a class="arrow back">&lt;</a>');
191				
192            // Bind to the forward and back buttons
193            $back.click(function(e){
194                base.goBack();
195				e.preventDefault();
196            });
197
198            $forward.click(function(e){
199                base.goForward();
200				e.preventDefault();
201            });
202
203			// Append elements to page
204			base.$wrapper.after($back).after($forward);
205		};
206		
207		// Creates the Start/Stop button
208		base.buildAutoPlay = function(){
209
210			base.$startStop = $("<a href='#' id='start-stop'></a>").html(base.playing ? base.options.stopText :  base.options.startText);
211			base.$el.append(base.$startStop);            
212            base.$startStop.click(function(e){
213				base.startStop(!base.playing);
214				e.preventDefault();
215            });
216
217			// Use the same setting, but trigger the start;
218			base.startStop(base.playing);
219		};
220		
221		// Handles stopping and playing the slideshow
222		// Pass startStop(false) to stop and startStop(true) to play
223		base.startStop = function(playing){
224			if(playing !== true) playing = false; // Default if not supplied is false
225			
226			// Update variable
227			base.playing = playing;
228			
229			// Toggle playing and text
230			if(base.options.autoPlay) base.$startStop.toggleClass("playing", playing).html( playing ? base.options.stopText : base.options.startText );
231			
232			if(playing){
233				base.clearTimer(); // Just in case this was triggered twice in a row
234				base.timer = window.setInterval(function(){
235					base.goForward(true);
236				}, base.options.delay);
237			} else {
238				base.clearTimer();
239			};
240		};
241		
242		base.clearTimer = function(){
243			// Clear the timer only if it is set
244			if(base.timer) window.clearInterval(base.timer);
245		};
246		
247		// Taken from AJAXY jquery.history Plugin
248		base.setHash = function ( hash ) {
249			// Write hash
250			if ( typeof window.location.hash !== 'undefined' ) {
251				if ( window.location.hash !== hash ) {
252					window.location.hash = hash;
253				};
254			} else if ( location.hash !== hash ) {
255				location.hash = hash;
256			};
257			
258			// Done
259			return hash;
260		};
261		// <-- End AJAXY code
262
263
264		// Trigger the initialization
265        base.init();
266    };
267
268	
269    $.anythingSlider.defaults = {
270        easing: "swing",                // Anything other than "linear" or "swing" requires the easing plugin
271        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not
272        startStopped: false,            // If autoPlay is on, this can force it to start stopped
273        delay: 3000,                    // How long between slide transitions in AutoPlay mode
274        animationTime: 600,             // How long the slide transition takes
275        hashTags: true,                 // Should links change the hashtag in the URL?
276        buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
277        pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
278		startText: "Start",             // Start text
279		stopText: "Stop",               // Stop text
280		navigationFormatter: null       // Details at the top of the file on this use (advanced use)
281    };
282	
283
284    $.fn.anythingSlider = function(options){
285		if(typeof(options) == "object"){
286		    return this.each(function(i){			
287				(new $.anythingSlider(this, options));
288
289	            // This plugin supports multiple instances, but only one can support hash-tag support
290				// This disables hash-tags on all items but the first one
291				options.hashTags = false;
292	        });	
293		} else if (typeof(options) == "number") {
294
295			return this.each(function(i){
296				var anySlide = $(this).data('AnythingSlider');
297				if(anySlide){
298					anySlide.gotoPage(options);
299				}
300			});
301		}
302    };
303
304	
305})(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.