PageSourceSearch

http://hairsalon.com.tw/new/scripts/banner-slider/js/sangarSlider/sangarShift.js

js hairsalon.com.tw collected 2026-10-06 06:24:05 UTC 15,954 bytes, 368 lines download raw bytes

1var sangarShift;
2
3;(function($) {
4
5	sangarShift = function(base, opt) {
6
7		/**
8	     * Function: shift
9	     */
10	    this.shift = function(direction, doAnimation)
11	    {
12	    	// before slide function
13	    	base.beforeSlideChange(); 
14
15	        // remember previous activeSlide
16	        base.prevActiveSlide = base.activeSlide;
17	        var slideDirection = direction;
18
19	        // remember slideDirection to base
20	        base.slideDirection = slideDirection;
21
22	        // exit function if bullet clicked is same as the current image
23	        if (base.prevActiveSlide == slideDirection) {
24	            return false;
25	        }
26
27	        if (! base.locked) 
28	        {
29	            base.lock();
30	            
31	            if (direction == "next") 
32	            {		            	
33	                base.activeSlide++;
34	                base.activeSlideContinous++;
35	                if (base.activeSlide == base.numberSlides) {
36	                    base.activeSlide = 0;
37	                }
38	            } 
39	            else if (direction == "prev") 
40	            {
41	                base.activeSlide--
42	                base.activeSlideContinous--
43	                if (base.activeSlide < 0) {
44	                    base.activeSlide = base.numberSlides - 1;
45	                }
46	            } 
47	            else 
48	            {
49	                var mod_position = base.activeSlideContinous % base.numberSlides;
50	                var float_position = base.activeSlideContinous - mod_position;
51
52	                for (var i = 0; i < direction; i++) 
53	                {
54	                    float_position++
55
56	                    if(i == direction)
57	                    {
58	                        break;
59	                    }
60	                }
61
62	                // for minus position (back)
63	                if(base.activeSlideContinous < 0 && mod_position != 0)
64	                {
65	                    float_position = float_position - base.numberSlides;
66	                }
67
68	                base.activeSlideContinous = float_position;
69	                base.activeSlide = direction;
70
71	                if (base.prevActiveSlide < base.activeSlide) 
72	                {
73	                    slideDirection = "next";
74	                } 
75	                else if (base.prevActiveSlide > base.activeSlide) 
76	                {
77	                    slideDirection = "prev"
78	                }
79	            }
80
81	            // set to correct bullet
82	            base.bulletObj.setActiveBullet();
83	            base.calculateHeightWidth();
84
85	            // set current slide
86            	base.setCurrentSlide();
87
88	            
89	            /**
90	             * Horizontal Slide
91	             */
92	            if (opt.animation == "horizontal-slide")
93	            {
94	            	// vertical text pagination
95					base.sangarWidth = base.verticalTextPaginationSetWidth();
96
97	                if(opt.continousSliding)
98	                {
99                        var slide_action_pure = base.sangarWidth * base.activeSlideContinous;
100                        var slide_action = slide_action_pure * -1;
101
102                        // get slideWrapperWidth
103                        var slideWrapper = base.$slideWrapper.children('.slideWrapperInside');
104	                    var slide = slideWrapper.children('.sangar-content');
105	                    var slideWrapperWidth = slide.width() * base.numberSlides;
106	
107	                    // define classes
108	                 	var swi1st = base.$slideWrapper.children('.slideWrapperInside.swi1st');
109                        var swi2nd = base.$slideWrapper.children('.slideWrapperInside.swi2nd');
110                        var swi3rd = base.$slideWrapper.children('.slideWrapperInside.swi3rd');
111
112	                    if(direction == "next" && base.activeSlide == 0)
113	                    {
114	                    	// disable transitions
115                        	swi1st.addClass('notransition'); 
116
117	                        // move first group to last
118	                        swi1st.css('margin-left', (slide_action_pure + slideWrapperWidth) + 'px');
119
120	                        // redefined classes
121	                        swi1st.removeClass('swi1st').addClass('swi3rd');
122	                        swi2nd.removeClass('swi2nd').addClass('swi1st');
123	                        swi3rd.removeClass('swi3rd').addClass('swi2nd');
124
125	                        // re-enable transitions
126	                        swi1st[0].offsetHeight; // Trigger a reflow, flushing the CSS changes
127	                        swi1st.removeClass('notransition'); // Re-enable transitions
128	                    }
129	                    else if(direction == "prev" && base.activeSlide == (base.numberSlides - 1))
130	                    {
131	                    	// disable transitions
132                        	swi3rd.addClass('notransition'); 
133
134	                    	// move first group to last
135	                        swi3rd.css('margin-left', (slide_action_pure - slideWrapperWidth - (slideWrapperWidth - base.sangarWidth)) + 'px');
136
137	                        // redefined classes
138	                        swi1st.removeClass('swi1st').addClass('swi2nd');
139	                        swi2nd.removeClass('swi2nd').addClass('swi3rd');
140	                        swi3rd.removeClass('swi3rd').addClass('swi1st');
141
142	                        // re-enable transitions
143	                        swi3rd[0].offsetHeight; // Trigger a reflow, flushing the CSS changes
144	                        swi3rd.removeClass('notransition'); // Re-enable transitions
145	                    }
146
147
148	                    // animation
149	                    if(base.css3support())
150	                    {
151	                        var properties = {};	                        
152	                        properties[ '-' + base.vendorPrefix + '-transition' ] = opt.animationSpeed + 'ms cubic-bezier(0.445, 0.05, 0.55, 0.95)';
153	                        properties[ '-' + base.vendorPrefix + '-transform' ] = 'translate('+ slide_action +'px, 0)';
154	                        properties[ '-' + base.vendorPrefix + '-transform-style' ] = 'preserve-3d';	                        
155                            properties[ '-' + base.vendorPrefix + '-backface-visibility' ] = 'hidden';	                        
156                        	properties[ '-' + base.vendorPrefix + '-perspective' ] = '1000px';
157
158	                        // Do the CSS3 transition
159	                        base.$slideWrapper.css(properties);
160
161	                        base.resetAndUnlock();
162	                    }
163	                    else
164	                    {
165	                        base.$slideWrapper
166	                        .animate({
167	                            "left": slide_action + 'px'
168	                        }, opt.animationSpeed, base.resetAndUnlock);
169	                    }
170
171
172	                    // showAllSlide
173			            if(opt.showAllSlide)
174			            {
175		                    this.doBlur('.swi2nd',base.activeSlide,1);
176		                    this.doBlur('.swi2nd',base.prevActiveSlide,0.5);
177
178		                    if(base.prevActiveSlide == 0){
179		                    	this.doBlur('.swi3rd',base.prevActiveSlide,0.5);
180		                    }
181
182		                    if(base.prevActiveSlide == (base.numberSlides - 1)){
183		                    	this.doBlur('.swi1st',base.prevActiveSlide,0.5);
184		                    }
185		                }
186	                }
187	                else
188	                {
189	                    var slide_action = base.sangarWidth * base.activeSlide < base.numberSlides * base.sangarWidth ? '-' + base.sangarWidth * base.activeSlide : 0 ;
190
191	                    if(doAnimation)
192	                    {
193	                        if(base.css3support())
194	                        {
195	                            // Get the properties to transition
196	                            var properties = {};
197	                            properties[ '-' + base.vendorPrefix + '-transition' ] = opt.animationSpeed + 'ms cubic-bezier(0.445, 0.05, 0.55, 0.95)';
198	                            properties[ '-' + base.vendorPrefix + '-transform' ] = 'translate('+ slide_action +'px, 0)';
199	                            properties[ '-' + base.vendorPrefix + '-transform-style' ] = 'preserve-3d';	                        
200	                            properties[ '-' + base.vendorPrefix + '-backface-visibility' ] = 'hidden';	                        
201	                        	properties[ '-' + base.vendorPrefix + '-perspective' ] = '1000px';
202
203	                            // Do the CSS3 transition
204	                            base.$slideWrapper.css(properties);
205	                            
206	                            base.resetAndUnlock();
207	                        }
208	                        else
209	                        {
210	                            base.$slideWrapper
211	                                .animate({
212	                                    "left": slide_action + 'px'
213	                                }, opt.animationSpeed, base.resetAndUnlock);
214	                        }
215	                    }
216	                    else
217	                    {
218	                        base.resetAndUnlock();
219	                    }
220	                }
221	            }
222
223	            /**
224	             * Vertical Slide
225	             */
226	            if (opt.animation == "vertical-slide") 
227	            {
228	                if(opt.continousSliding)
229	                {
230	                	var slide_action_pure = base.sangarHeight * base.activeSlideContinous;
231                        var slide_action = slide_action_pure * -1;
232
233                        // get slideWrapperHeight
234                        var slideWrapper = base.$slideWrapper.children('.slideWrapperInside');
235	                    var slide = slideWrapper.children('.sangar-content');
236	                    var slideWrapperHeight = slide.height() * base.numberSlides;
237	                    	                   
238	                    // define classes
239	                 	var swi1st = base.$slideWrapper.children('.slideWrapperInside.swi1st');
240                        var swi2nd = base.$slideWrapper.children('.slideWrapperInside.swi2nd');
241                        var swi3rd = base.$slideWrapper.children('.slideWrapperInside.swi3rd');
242
243	                    if(direction == "next" && base.activeSlide == 0)
244	                    {
245	                    	// disable transitions
246                        	swi1st.addClass('notransition'); 
247
248	                        // move first group to last
249	                        swi1st.css('margin-top', (slide_action_pure + slideWrapperHeight) + 'px');
250
251	                        // redefined classes
252	                        swi1st.removeClass('swi1st').addClass('swi3rd');
253	                        swi2nd.removeClass('swi2nd').addClass('swi1st');
254	                        swi3rd.removeClass('swi3rd').addClass('swi2nd');
255
256	                        // re-enable transitions
257	                        swi1st[0].offsetHeight; // Trigger a reflow, flushing the CSS changes
258	                        swi1st.removeClass('notransition'); // Re-enable transitions
259	                    }
260	                    else if(direction == "prev" && base.activeSlide == (base.numberSlides - 1))
261	                    {
262	                    	// disable transitions
263                        	swi3rd.addClass('notransition'); 
264
265	                    	// move first group to last
266	                        swi3rd.css('margin-top', (slide_action_pure - slideWrapperHeight - (slideWrapperHeight - base.sangarHeight)) + 'px');
267
268	                        // redefined classes
269	                        swi1st.removeClass('swi1st').addClass('swi2nd');
270	                        swi2nd.removeClass('swi2nd').addClass('swi3rd');
271	                        swi3rd.removeClass('swi3rd').addClass('swi1st');
272
273	                        // re-enable transitions
274	                        swi3rd[0].offsetHeight; // Trigger a reflow, flushing the CSS changes
275	                        swi3rd.removeClass('notransition'); // Re-enable transitions
276	                    }
277
278
279	                    // animation
280	                    if(base.css3support())
281	                    {
282	                        var properties = {};
283	                        properties[ '-' + base.vendorPrefix + '-transition' ] = opt.animationSpeed + 'ms cubic-bezier(0.445, 0.05, 0.55, 0.95)';
284	                        properties[ '-' + base.vendorPrefix + '-transform' ] = 'translate(0, '+ slide_action +'px)';
285	                        properties[ '-' + base.vendorPrefix + '-transform-style' ] = 'preserve-3d';	                        
286							properties[ '-' + base.vendorPrefix + '-backface-visibility' ] = 'hidden';	                        
287							properties[ '-' + base.vendorPrefix + '-perspective' ] = '1000px';
288
289	                        // Do the CSS3 transition
290	                        base.$slideWrapper.css(properties);
291
292	                        base.resetAndUnlock();
293	                    }
294	                    else
295	                    {
296	                        base.$slideWrapper
297	                        .animate({
298	                            "top": slide_action + 'px'
299	                        }, opt.animationSpeed, base.resetAndUnlock);
300	                    }
301	                }
302	                else
303	                {
304	                    var slide_action = base.sangarHeight * base.activeSlide < base.numberSlides * base.sangarHeight ? '-' + base.sangarHeight * base.activeSlide : 0 ;
305
306	                    if(doAnimation)
307	                    {
308	                        if(base.css3support())
309	                        {
310	                            // Get the properties to transition
311	                            var properties = {};
312	                            properties[ '-' + base.vendorPrefix + '-transition' ] = opt.animationSpeed + 'ms cubic-bezier(0.445, 0.05, 0.55, 0.95)';
313		                        properties[ '-' + base.vendorPrefix + '-transform' ] = 'translate(0, '+ slide_action +'px)';
314		                        properties[ '-' + base.vendorPrefix + '-transform-style' ] = 'preserve-3d';	                        
315								properties[ '-' + base.vendorPrefix + '-backface-visibility' ] = 'hidden';	                        
316								properties[ '-' + base.vendorPrefix + '-perspective' ] = '1000px';
317
318	                            // Do the CSS3 transition
319	                            base.$slideWrapper.css(properties);
320	                            base.resetAndUnlock();
321	                        }
322	                        else
323	                        {
324	                            base.$slideWrapper
325	                                .animate({
326	                                    "top": slide_action + 'px'
327	                                }, opt.animationSpeed, base.resetAndUnlock);
328	                        }
329	                    }
330	                    else
331	                    {
332	                        base.resetAndUnlock();
333	                    }
334	                }	                
335	            }
336
337	            /**
338	             * Fade
339	             */
340	            if (opt.animation == "fade") 
341	            {
342	            	// hide and put prevActiveSlide to z-index 2
343                    base.$slides
344                        .eq(base.prevActiveSlide)
345                        .css({
346                            "opacity": 1,
347                            "z-index": 2
348                        })
349                        .animate({
350                            "opacity": 0
351                        }, opt.animationSpeed, base.resetAndUnlock);
352
353                    // show and put activeSlide to z-index 3
354                    base.$slides
355                        .eq(base.activeSlide)
356                        .css({
357                            "opacity": 0,
358                            "z-index": 3
359                        })
360                        .animate({
361                            "opacity": 1
362                        }, opt.animationSpeed, base.resetAndUnlock);
363	            }
364	        }
365	    }
366	}
367
368})(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.