PageSourceSearch

https://www.paris-lotus.com/modules/wtslideshow/views/js/layerslider.kreaturamedia.jquery.js

js paris-lotus.com collected 2026-10-04 23:28:32 UTC 146,210 bytes, 4,905 lines download raw bytes

1
2/*
3	* LayerSlider
4	*
5	* (c) 2011-2014 George Krupa, John Gera & Kreatura Media
6	*
7	* Plugin web:			http://kreaturamedia.com/
8	* licenses:				http://codecanyon.net/licenses/
9*/
10
11
12
13function lsShowNotice(lsobj,issue,ver){
14
15	var el;
16
17	if( typeof lsobj == 'string' ){
18		el = jQuery('#'+lsobj);
19	}else if( typeof lsobj == 'object' ){
20		el = lsobj;
21	}
22
23	var errorTitle, errorText;
24
25	switch(issue){
26		case 'jquery':
27		errorTitle = 'multiple jQuery issue';
28		errorText = 'It looks like that another plugin or your theme loads an extra copy of the jQuery library causing problems for LayerSlider to show your sliders. <strong>Please navigate on your WordPress admin area to the main page of LayerSlider and enable the "Put JS includes to body" option within the Troubleshooting & Advanced Settings box.</strong>';
29		break;
30		case 'oldjquery':
31		errorTitle = 'old jQuery issue';
32		errorText = 'It looks like you are using an old version ('+ver+') of the jQuery library. LayerSlider requires at least version 1.7.0 or newer. Please update jQuery to 1.10.x or higher. Important: Please do not use the jQuery Updater plugin on WordPress and do not update to 2.x version of jQuery because it is not compatible with older browsers like IE 7 & 8. <a href="http://support.kreaturamedia.com/faq/4/layerslider-for-wordpress/#group-13&entry-60">You can read more about updating jQuery by clicking here.</a>';
33		break;
34	}
35
36	el.addClass('ls-error');
37	el.append('<p class="ls-exclam">!</p>');
38	el.append('<p class="ls-error-title">LayerSlider: '+errorTitle+'</p>');
39	el.append('<p class="ls-error-text">'+errorText+'</p>');
40}
41
42(function($) {
43
44	$.fn.layerSlider = function( options ){
45
46		// IMPROVEMENT v4.1.0 Checking jQuery version
47		// IMPROVEMENT v4.1.3 Changed required version from 1.7.2 to 1.7.0
48
49		var reqVer = '1.7.0';
50		var curVer = $.fn.jquery;
51		var el = $(this);
52
53		var checkVersions = function(v1,v2){
54
55			var v1parts = v1.split('.');
56			var v2parts = v2.split('.');
57
58			for (var i = 0; i < v1parts.length; ++i) {
59
60				if (v2parts.length == i) {
61					return false;
62				}
63
64				if(parseInt(v1parts[i]) == parseInt(v2parts[i])){
65					continue;
66				}else if (parseInt(v1parts[i]) > parseInt(v2parts[i])){
67					return false;
68				}else{
69					return true;
70				}
71			}
72
73			if (v1parts.length != v2parts.length) {
74				return true;
75			}
76
77			return true;
78		};
79
80		if( !checkVersions('1.8.0',curVer) ){
81			el.addClass('ls-norotate');
82		}
83
84		// Initializing if jQuery version is greater than 1.7.0
85
86		if( !checkVersions(reqVer,curVer) ){
87			lsShowNotice( el, 'oldjquery', curVer );
88		}else{
89
90			if( (typeof(options)).match('object|undefined') ){
91				return this.each(function(i){
92					new layerSlider(this, options);
93				});
94			}else{
95				if( options == 'data' ){
96					var lsData = $(this).data('LayerSlider').g;
97					if( lsData ){
98						return lsData;
99					}
100				}else{
101					return this.each(function(i){
102
103						// Control functions: prev, next, start, stop & change
104
105						var lsData = $(this).data('LayerSlider');
106						if( lsData ){
107							if( !lsData.g.isAnimating && !lsData.g.isLoading ){
108								if( typeof options == 'number' ){
109									if( options > 0 && options < lsData.g.layersNum + 1 && options != lsData.g.curLayerIndex ){
110										lsData.change(options);
111									}
112								}else{
113									switch(options){
114										case 'prev':
115											lsData.o.cbPrev(lsData.g);
116											lsData.prev('clicked');
117											break;
118										case 'next':
119											lsData.o.cbNext(lsData.g);
120											lsData.next('clicked');
121											break;
122										case 'start':
123											if( !lsData.g.autoSlideshow ){
124												lsData.o.cbStart(lsData.g);
125												lsData.g.originalAutoSlideshow = true;
126												lsData.start();
127											}
128											break;
129									}
130								}
131							}
132							if( options == 'debug' ){
133								lsData.d.show();
134							}
135							if( ( lsData.g.autoSlideshow || ( !lsData.g.autoSlideshow && lsData.g.originalAutoSlideshow ) ) && options == 'stop' ){
136								lsData.o.cbStop(lsData.g);
137								lsData.g.originalAutoSlideshow = false;
138								lsData.g.curLayer.find('iframe[src*="www.youtu"], iframe[src*="player.vimeo"]').each(function(){
139
140									// Clearing videoTimeouts
141
142									clearTimeout( $(this).data( 'videoTimer') );
143								});
144
145								lsData.stop();
146							}
147							if( options == 'forceStop'){
148								lsData.forcestop();
149							}
150						}
151					});
152				}
153			}
154		}
155	};
156
157	// LayerSlider methods
158
159	var layerSlider = function(el, options) {
160
161		var ls = this;
162		ls.$el = $(el).addClass('ls-container');
163		ls.$el.data('LayerSlider', ls);
164
165		ls.load = function(){
166
167			// Setting options (user settings) and global (not modificable) parameters
168
169			ls.o = $.extend({},layerSlider.options, options);
170			ls.g = $.extend({},layerSlider.global);
171			ls.lt = $.extend({},layerSlider.layerTransitions );
172			ls.st = $.extend({},layerSlider.slideTransitions );
173
174			ls.g.enableCSS3 = $(el).hasClass('ls-norotate') ? false : true;
175
176			if( ls.g.ie78 ){
177				ls.o.lazyLoad = false;
178			}
179
180			// WP parameters
181
182			if( ls.o.autoPauseSlideshow === 'enabled' ){
183				ls.o.autoPauseSlideshow = true;
184			}
185			if( ls.o.autoPauseSlideshow === 'disabled' ){
186				ls.o.autoPauseSlideshow = false;
187			}
188
189			// If layerslider.transitions.js is loaded...
190
191			if( typeof layerSliderTransitions !== 'undefined' ){
192				ls.t = $.extend({},layerSliderTransitions);
193			}
194
195			// If custom transitions are loaded...
196
197			if( typeof layerSliderCustomTransitions !== 'undefined' ){
198				ls.ct = $.extend({},layerSliderCustomTransitions);
199			}
200
201			// NEW IMPROVEMENT v3.6 forbid to call the init code more than once on the same element
202
203			if( !ls.g.initialized ){
204
205				ls.g.initialized = true;
206
207				// Added debug mode v3.5
208
209				ls.debug();
210
211				if( $('html').find('meta[content*="WordPress"]').length ){
212					ls.g.wpVersion = $('html').find('meta[content*="WordPress"]').attr('content').split('WordPress')[1];
213				}
214
215				if( $('html').find('script[src*="layerslider"]').length ){
216					if( $('html').find('script[src*="layerslider"]').attr('src').indexOf('?') != -1 ){
217						ls.g.lswpVersion = $('html').find('script[src*="layerslider"]').attr('src').split('?')[1].split('=')[1];
218					}
219				}
220
221				// Debug mode controls
222
223				ls.d.aT('LayerSlider controls');
224				ls.d.aU('<a href="#">prev</a> | <a href="#">next</a> | <a href="#">start</a> | <a href="#">stop</a> | <a href="#">force stop</a>');
225				ls.d.history.find('a').each(function(){
226					$(this).click(function(e){
227						e.preventDefault();
228						$(el).layerSlider($(this).text());
229					});
230				});
231
232				ls.d.aT('LayerSlider version information');
233				ls.d.aU('JS version: <strong>' + ls.g.version + '</strong>');
234				if(ls.g.lswpVersion){
235					ls.d.aL('WP version: <strong>' + ls.g.lswpVersion + '</strong>');
236				}
237				if(ls.g.wpVersion){
238					ls.d.aL('WordPress version: <strong>' + ls.g.wpVersion + '</strong>');
239				}
240
241				ls.d.aL('jQuery version: <strong>' + $().jquery + '</strong>');
242
243				if( $(el).attr('id') ){
244
245					ls.d.aT('LayerSlider container');
246					ls.d.aU('#'+$(el).attr('id'));
247				}
248
249				// NEW LOAD METHOD v3.5
250				// FIXED v4.0 If the selected skin is already loaded, calling the ls.init() function immediately
251
252				if( !ls.o.skin || ls.o.skin == '' || !ls.o.skinsPath || ls.o.skinsPath == '' ){
253
254					ls.d.aT('Loading without skin. Possibilities: mistyped skin and / or skinsPath.');
255
256					ls.init();
257				}else{
258
259					ls.d.aT('Trying to load with skin: '+ls.o.skin, true);
260
261					// Applying skin
262
263					$(el).addClass('ls-'+ls.o.skin);
264
265					var skinStyle = ls.o.skinsPath+ls.o.skin+'/skin.css';
266
267					cssContainer = $('head');
268
269					if( !$('head').length ){
270						cssContainer = $('body');
271					}
272
273					if( $('link[href="'+skinStyle+'"]').length ){
274
275						ls.d.aU('Skin "'+ls.o.skin+'" is already loaded.');
276
277						curSkin = $('link[href="'+skinStyle+'"]');
278
279						if( !ls.g.loaded ){
280
281							ls.g.loaded = true;
282
283							// IMPROVEMENT v4.5.0 Added delay because of caching bugs
284
285					ls.g.t1 = setTimeout(function(){
286								ls.init();
287							},150);
288						}
289
290					}else{
291						if (document.createStyleSheet){
292							document.createStyleSheet(skinStyle);
293							var curSkin = $('link[href="'+skinStyle+'"]');
294						}else{
295							var curSkin = $('<link rel="stylesheet" href="'+skinStyle+'" type="text/css" />').appendTo( cssContainer );
296						}
297					}
298
299					// curSkin.load(); function for most of the browsers.
300
301					curSkin.load(function(){
302
303						if( !ls.g.loaded ){
304
305							ls.d.aU('curSkin.load(); fired');
306
307							ls.g.loaded = true;
308
309							// IMPROVEMENT v4.5.0 Added delay because of caching bugs
310
311					ls.g.t2 = setTimeout(function(){
312								ls.init();
313							},150);
314						}
315					});
316
317					// $(window).load(); function for older webkit ( < v536 ).
318
319					$(window).load(function(){
320
321						if( !ls.g.loaded ){
322
323							ls.d.aU('$(window).load(); fired');
324
325							ls.g.loaded = true;
326
327							// IMPROVEMENT v4.5.0 Added delay because of caching bugs
328
329					ls.g.t3 = setTimeout(function(){
330								ls.init();
331							},150);
332						}
333					});
334
335					// Fallback: if $(window).load(); not fired in 2 secs after $(document).ready(),
336					// curSkin.load(); not fired at all or the name of the skin and / or the skinsPath
337					// mistyped, we must call the init function manually.
338
339					ls.g.t4 = setTimeout( function(){
340
341						if( !ls.g.loaded ){
342
343							ls.d.aT('Fallback mode: Neither curSkin.load(); or $(window).load(); were fired');
344
345							ls.g.loaded = true;
346							ls.init();
347						}
348					}, 1000);
349				}
350			}
351		};
352
353		ls.init = function(){
354
355			// IMPROVEMENT v4.0.1 Trying to add special ID to <body> or <html> (required to overwrite WordPresss global styles)
356
357			if( !$('html').attr('id') ){
358				$('html').attr('id','ls-global');
359			}else if( !$('body').attr('id') ){
360				$('body').attr('id','ls-global');
361			}
362
363			// NEW FEATURE v1.7 making the slider responsive
364
365			ls.g.sliderWidth = function(){
366				return $(el).width();
367			}
368
369			ls.g.sliderHeight = function(){
370				return $(el).height();
371			}
372
373			// Compatibility mode v5.0.0
374			//	.ls-layer 	-> .ls-slide
375			//	.ls-s 		-> .ls-l
376
377			$(el).find('.ls-layer').removeClass('ls-layer').addClass('ls-slide');
378			$(el).find('.ls-slide > *[class*="ls-s"]').each(function(){
379				var oldDistanceNum = $(this).attr('class').split('ls-s')[1].split(' ')[0];
380				$(this).removeClass('ls-s'+oldDistanceNum).addClass('ls-l'+oldDistanceNum);
381			});
382
383
384			if( ls.o.firstLayer ){
385				ls.o.firstSlide = ls.o.firstLayer;
386			}
387			if( ls.o.animateFirstLayer === false ){
388				ls.o.animateFirstSlide = false;
389			}
390
391			// REPLACED FEATURE v2.0 If there is only ONE layer, instead of duplicating it, turning off slideshow and loops, hiding all controls, etc.
392
393			if( $(el).find('.ls-slide').length == 1 ){
394				ls.o.autoStart = false;
395				ls.o.navPrevNext = false;
396				ls.o.navStartStop = false;
397				ls.o.navButtons = false;
398				ls.o.loops = 0;
399				ls.o.forceLoopNum = false;
400				ls.o.autoPauseSlideshow	= true;
401				ls.o.firstSlide = 1;
402				ls.o.thumbnailNavigation = 'disabled';
403			}
404
405			// NEW FEATURE v3.0 added "normal" responsive mode with image and font resizing
406			// NEW FEATURE v3.5 responsiveUnder
407
408			if( ls.o.width ){
409				ls.g.sliderOriginalWidthRU = ls.g.sliderOriginalWidth = '' + ls.o.width;
410			}else{
411				ls.g.sliderOriginalWidthRU = ls.g.sliderOriginalWidth = $(el)[0].style.width;
412			}
413
414			if( ls.o.height ){
415				ls.g.sliderOriginalHeight = '' + ls.o.height;
416			}else{
417				ls.g.sliderOriginalHeight = $(el)[0].style.height;
418			}
419
420			if( ls.g.sliderOriginalWidth.indexOf('%') == -1 && ls.g.sliderOriginalWidth.indexOf('px') == -1 ){
421				ls.g.sliderOriginalWidth += 'px';
422			}
423
424			if( ls.g.sliderOriginalHeight.indexOf('%') == -1 && ls.g.sliderOriginalHeight.indexOf('px') == -1 ){
425				ls.g.sliderOriginalHeight += 'px';
426			}
427
428			if( ls.o.responsive && ls.g.sliderOriginalWidth.indexOf('px') != -1 && ls.g.sliderOriginalHeight.indexOf('px') != -1 ){
429				ls.g.responsiveMode = true;
430			}else{
431				ls.g.responsiveMode = false;
432			}
433
434			// IMPROVEMENT v3.0 preventing WordPress to wrap your sublayers in <code> or <p> elements
435
436			$(el).find('*[class*="ls-l"], *[class*="ls-bg"]').each(function(){
437				if( !$(this).parent().hasClass('ls-slide') ){
438					$(this).insertBefore( $(this).parent() );
439				}
440			});
441
442			$(el).find('.ls-slide').each(function(){
443				$(this).children(':not([class*="ls-"])').each(function(){
444					$(this).remove();
445				});
446
447				var hd = $('<div>').addClass('ls-gpuhack');
448				if( $(this).find('.ls-bg').length ){
449					hd.insertAfter( $(this).find('.ls-bg').eq('0') );
450				}else{
451					hd.prependTo( $(this) );
452				}
453			});
454
455			$(el).find('.ls-slide, *[class*="ls-l"]').each(function(){
456
457				if( $(this).data('ls') || $(this).attr('rel') || $(this).attr('style') ){
458					if( $(this).data('ls') ){
459						var params = $(this).data('ls').toLowerCase().split(';');
460					}else if( $(this).attr('rel') && $(this).attr('rel').indexOf(':') != -1 && $(this).attr('rel').indexOf(';') != -1 ){
461						var params = $(this).attr('rel').toLowerCase().split(';');
462					}else{
463						var params = $(this).attr('style').toLowerCase().split(';');
464					}
465					for(x=0;x<params.length;x++){
466						param = params[x].split(':');
467
468						if( param[0].indexOf('easing') != -1 ){
469							param[1] = ls.ieEasing( param[1] );
470						}
471
472						var p2 = '';
473						if( param[2] ){
474							p2 = ':'+$.trim(param[2]);
475						}
476
477						if( param[0] != ' ' && param[0] != '' ){
478							$(this).data( $.trim(param[0]), $.trim(param[1]) + p2 );
479						}
480					}
481				}
482
483				// NEW FEATURE v1.7 and v3.0 making the slider responsive - we have to use style.left instead of jQuery's .css('left') function!
484
485				var sl = $(this);
486
487				sl.data( 'originalLeft', sl[0].style.left );
488				sl.data( 'originalTop', sl[0].style.top );
489
490				if( $(this).is('a') && $(this).children().length > 0 ){
491					sl = $(this).children();
492				}
493
494				var _w = sl.width();
495				var _h = sl.height();
496
497				if( sl[0].style.width && sl[0].style.width.indexOf('%') != -1 ){
498					_w = sl[0].style.width;
499				}
500				if( sl[0].style.height && sl[0].style.height.indexOf('%') != -1 ){
501					_h = sl[0].style.height;
502				}
503
504				sl.data( 'originalWidth', _w );
505				sl.data( 'originalHeight', _h );
506
507				sl.data( 'originalPaddingLeft', sl.css('padding-left') );
508				sl.data( 'originalPaddingRight', sl.css('padding-right') );
509				sl.data( 'originalPaddingTop', sl.css('padding-top') );
510				sl.data( 'originalPaddingBottom', sl.css('padding-bottom') );
511
512				// iOS fade bug when GPU acceleration is enabled #1
513
514				var _o = typeof parseFloat( sl.css('opacity') ) == 'number'  ? Math.round( parseFloat( sl.css('opacity') ) * 100 ) / 100  : 1;
515				$(this).data( 'originalOpacity', _o );
516
517				if( sl.css('border-left-width').indexOf('px') == -1 ){
518					sl.data( 'originalBorderLeft', sl[0].style.borderLeftWidth );
519				}else{
520					sl.data( 'originalBorderLeft', sl.css('border-left-width') );
521				}
522				if( sl.css('border-right-width').indexOf('px') == -1 ){
523					sl.data( 'originalBorderRight', sl[0].style.borderRightWidth );
524				}else{
525					sl.data( 'originalBorderRight', sl.css('border-right-width') );
526				}
527				if( sl.css('border-top-width').indexOf('px') == -1 ){
528					sl.data( 'originalBorderTop', sl[0].style.borderTopWidth );
529				}else{
530					sl.data( 'originalBorderTop', sl.css('border-top-width') );
531				}
532				if( sl.css('border-bottom-width').indexOf('px') == -1 ){
533					sl.data( 'originalBorderBottom', sl[0].style.borderBottomWidth );
534				}else{
535					sl.data( 'originalBorderBottom', sl.css('border-bottom-width') );
536				}
537
538				sl.data( 'originalFontSize', sl.css('font-size') );
539				sl.data( 'originalLineHeight', sl.css('line-height') );
540			});
541
542			// CHANGED FEATURE v3.5 url- / deep linking layers
543
544			if( document.location.hash ){
545				for( var dl = 0; dl < $(el).find('.ls-slide').length; dl++ ){
546					if( $(el).find('.ls-slide').eq(dl).data('deeplink') == document.location.hash.split('#')[1] ){
547						ls.o.firstSlide = dl+1;
548					}
549				}
550			}
551
552			// NEW FEATURE v2.0 linkTo
553
554			$(el).find('*[class*="ls-linkto-"]').each(function(){
555				var lClasses = $(this).attr('class').split(' ');
556				for( var ll=0; ll<lClasses.length; ll++ ){
557					if( lClasses[ll].indexOf('ls-linkto-') != -1 ){
558						var linkTo = parseInt( lClasses[ll].split('ls-linkto-')[1] );
559						$(this).css({
560							cursor: 'pointer'
561						}).click(function(e){
562							e.preventDefault();
563							$(el).layerSlider( linkTo );
564						});
565					}
566				}
567			});
568
569			// Setting variables
570
571			ls.g.layersNum = $(el).find('.ls-slide').length;
572
573			// NEW FEATURE v3.5 randomSlideshow
574
575			if( ls.o.randomSlideshow && ls.g.layersNum > 2 ){
576				ls.o.firstSlide == 'random';
577				ls.o.twoWaySlideshow = false;
578			}else{
579				ls.o.randomSlideshow = false;
580			}
581
582			// NEW FEATURE v3.0 random firstSlide
583
584			if( ls.o.firstSlide == 'random' ){
585				ls.o.firstSlide = Math.floor(Math.random() * ls.g.layersNum+1);
586			}
587
588			ls.o.fisrtSlide = ls.o.fisrtSlide < ls.g.layersNum + 1 ? ls.o.fisrtSlide : 1;
589			ls.o.fisrtSlide = ls.o.fisrtSlide < 1 ? 1 : ls.o.fisrtSlide;
590
591			// NEW FEATURE v2.0 loops
592
593			ls.g.nextLoop = 1;
594
595			if( ls.o.animateFirstSlide ){
596				ls.g.nextLoop = 0;
597			}
598
599			// NEW FEATURE v2.0 videoPreview
600			// IMPROVEMENT v4.6.0 http / https support of embedded videos
601
602			var HTTP = document.location.href.indexOf('file:') === -1 ? '' : 'http:';
603
604			// Youtube videos
605
606			$(el).find('iframe[src*="www.youtu"], iframe[src*="youtu.be"]').each(function(){
607
608				// BUGFIX v4.1.0 Firefox embedded video fix
609
610				$(this).parent().addClass('ls-video-layer');
611
612				if( $(this).parent('[class*="ls-l"]') ){
613
614					var iframe = $(this);
615					var http = HTTP;
616
617					// Getting thumbnail
618
619					$.getJSON( http + '//gdata.youtube.com/feeds/api/videos/' + $(this).attr('src').split('embed/')[1].split('?')[0] + '?v=2&alt=json&callback=?', function(data) {
620
621						iframe.data( 'videoDuration', parseInt(data['entry']['media$group']['yt$duration']['seconds']) * 1000 );
622					});
623
624					var vpContainer = $('<div>').addClass('ls-vpcontainer').appendTo( $(this).parent() );
625
626					if( ls.o.lazyLoad ){
627						$('<img>').appendTo( vpContainer ).addClass('ls-videopreview').attr('alt', 'Play video').data('src',  http + '//img.youtube.com/vi/' + $(this).attr('src').split('embed/')[1].split('?')[0] + '/' + ls.o.youtubePreview );
628					}else{
629						$('<img>').appendTo( vpContainer ).addClass('ls-videopreview').attr('alt', 'Play video').attr('src',  http + '//img.youtube.com/vi/' + $(this).attr('src').split('embed/')[1].split('?')[0] + '/' + ls.o.youtubePreview );
630					}
631					$('<div>').appendTo( vpContainer ).addClass('ls-playvideo');
632
633					$(this).parent().css({
634						width : $(this).width(),
635						height : $(this).height()
636					}).click(function(){
637
638						ls.g.isAnimating = true;
639
640						if( ls.g.paused ){
641							if( ls.o.autoPauseSlideshow != false ){
642								ls.g.paused = false;
643							}
644							ls.g.originalAutoSlideshow = true;
645						}else{
646							ls.g.originalAutoSlideshow = ls.g.autoSlideshow;
647						}
648
649						if( ls.o.autoPauseSlideshow != false ){
650							ls.stop();
651						}
652
653						ls.g.pausedByVideo = true;
654
655						http = $(this).find('iframe').data('videoSrc').indexOf('http') === -1 ? HTTP : '';
656
657						$(this).find('iframe').attr('src', http + $(this).find('iframe').data('videoSrc') );
658						$(this).find('.ls-vpcontainer').delay(ls.g.v.d).fadeOut(ls.g.v.fo, function(){
659							if( ls.o.autoPauseSlideshow == 'auto' && ls.g.originalAutoSlideshow == true ){
660								var videoTimer = setTimeout(function() {
661										ls.start();
662								}, iframe.data( 'videoDuration') - ls.g.v.d );
663								iframe.data( 'videoTimer', videoTimer );
664							}
665							ls.g.isAnimating = false;
666							if( ls.g.resize == true ){
667								ls.makeResponsive( ls.g.curLayer, function(){
668									ls.g.resize = false;
669								});
670							}
671						});
672					});
673
674					var sep = '&';
675
676					if( $(this).attr('src').indexOf('?') == -1 ){
677						sep = '?';
678					}
679
680					// BUGFIX v5.1.0 Fixed several issues with embedded videos (mostly under Firefox and IE)
681					// fixed 'only audio but no video' bug, fixed 'unclickable video controls' bug, fixed 'hidden slider controls' bug
682
683					var videoFix = '&wmode=opaque&html5=1';
684
685					// BUGFIX v5.1.0 Fixed autoplay parameter
686
687					if( $(this).attr('src').indexOf('autoplay') == -1 ){
688						$(this).data( 'videoSrc', $(this).attr('src') + sep + 'autoplay=1' + videoFix );
689					}else{
690						$(this).data( 'videoSrc', $(this).attr('src').replace('autoplay=0','autoplay=1') + videoFix );
691					}
692
693					$(this).data( 'originalWidth', $(this).attr('width') );
694					$(this).data( 'originalHeight', $(this).attr('height') );
695					$(this).attr('src','');
696				}
697			});
698
699			// Vimeo videos
700
701			$(el).find('iframe[src*="player.vimeo"]').each(function(){
702
703				// BUGFIX v4.1.0 Firefox embedded video fix
704
705				$(this).parent().addClass('ls-video-layer');
706
707				if( $(this).parent('[class*="ls-l"]') ){
708
709					var iframe = $(this);
710					var http = HTTP;
711
712					// Getting thumbnail
713
714					var vpContainer = $('<div>').addClass('ls-vpcontainer').appendTo( $(this).parent() );
715
716					$.getJSON( http + '//vimeo.com/api/v2/video/'+ ( $(this).attr('src').split('video/')[1].split('?')[0] ) +'.json?callback=?', function(data){
717
718						if( ls.o.lazyLoad ){
719							$('<img>').appendTo( vpContainer ).addClass('ls-videopreview').attr('alt', 'Play video').data('src', data[0]['thumbnail_large'] );
720						}else{
721							$('<img>').appendTo( vpContainer ).addClass('ls-videopreview').attr('alt', 'Play video').attr('src', data[0]['thumbnail_large'] );
722						}
723						iframe.data( 'videoDuration', parseInt( data[0]['duration'] ) * 1000 );
724						$('<div>').appendTo( vpContainer ).addClass('ls-playvideo');
725					});
726
727
728					$(this).parent().css({
729						width : $(this).width(),
730						height : $(this).height()
731					}).click(function(){
732
733						ls.g.isAnimating = true;
734
735						if( ls.g.paused ){
736							if( ls.o.autoPauseSlideshow != false ){
737								ls.g.paused = false;
738							}
739							ls.g.originalAutoSlideshow = true;
740						}else{
741							ls.g.originalAutoSlideshow = ls.g.autoSlideshow;
742						}
743
744						if( ls.o.autoPauseSlideshow != false ){
745							ls.stop();
746						}
747
748						ls.g.pausedByVideo = true;
749
750						http = $(this).find('iframe').data('videoSrc').indexOf('http') === -1 ? HTTP : '';
751
752						$(this).find('iframe').attr('src', http + $(this).find('iframe').data('videoSrc') );
753						$(this).find('.ls-vpcontainer').delay(ls.g.v.d).fadeOut(ls.g.v.fo, function(){
754							if( ls.o.autoPauseSlideshow == 'auto' && ls.g.originalAutoSlideshow == true ){
755								var videoTimer = setTimeout(function() {
756										ls.start();
757								}, iframe.data( 'videoDuration') - ls.g.v.d );
758								iframe.data( 'videoTimer', videoTimer );
759							}
760							ls.g.isAnimating = false;
761							if( ls.g.resize == true ){
762								ls.makeResponsive( ls.g.curLayer, function(){
763									ls.g.resize = false;
764								});
765							}
766						});
767					});
768
769					var sep = '&';
770
771					if( $(this).attr('src').indexOf('?') == -1 ){
772						sep = '?';
773					}
774
775					// BUGFIX v5.1.0 Fixed several issues with embedded videos (mostly under Firefox and IE)
776					// fixed 'only audio but no video' bug, fixed 'unclickable video controls' bug, fixed 'hidden slider controls' bug
777
778					var videoFix = '&wmode=opaque';
779
780					// BUGFIX v5.1.0 Fixed autoplay parameter
781
782					if( $(this).attr('src').indexOf('autoplay') == -1 ){
783						$(this).data( 'videoSrc', $(this).attr('src') + sep + 'autoplay=1' + videoFix );
784					}else{
785						$(this).data( 'videoSrc', $(this).attr('src').replace('autoplay=0','autoplay=1') + videoFix );
786					}
787
788					$(this).data( 'originalWidth', $(this).attr('width') );
789					$(this).data( 'originalHeight', $(this).attr('height') );
790					$(this).attr('src','');
791				}
792			});
793
794			// NEW FEATURE v5.0.0 HTML5 Video Support
795
796			$(el).find('video, audio').each(function(){
797
798				// BUGFIX v5.1.0 fixed HTML5 video sizing issue (again :)
799
800				var ow = typeof $(this).attr('width') !== 'undefined' ? $(this).attr('width') : '640';
801				var oh = typeof $(this).attr('height') !== 'undefined' ? $(this).attr('height') : '' + $(this).height();
802
803				if( ow.indexOf('%') === -1 ){
804					ow = parseInt( ow );
805				}
806
807				if( oh.indexOf('%') === -1 ){
808					oh = parseInt( oh );
809				}
810
811				if( ow === '100%' && ( oh === 0 || oh === '0' || oh === '100%' ) ){
812					$(this).attr('height', '100%');
813					oh = 'auto';
814				}
815
816				$(this).parent().addClass('ls-video-layer').css({
817					width : ow,
818					height : oh
819				}).data({
820					originalWidth : ow,
821					originalHeight : oh
822				});
823
824				var curVideo = $(this);
825
826				$(this).removeAttr('width').removeAttr('height').css({
827					width : '100%',
828					height : '100%'
829				}).click(function(){
830
831					if( typeof curVideo.attr('controls') === "undefined" ){
832						this.currentTime = 0;
833						this.play();
834					}
835
836					ls.g.isAnimating = true;
837
838					if( ls.g.paused ){
839						if( ls.o.autoPauseSlideshow !== false ){
840							ls.g.paused = false;
841						}
842						ls.g.originalAutoSlideshow = true;
843					}else{
844						ls.g.originalAutoSlideshow = ls.g.autoSlideshow;
845					}
846
847					if( ls.o.autoPauseSlideshow !== false ){
848						ls.stop();
849					}
850
851					ls.g.pausedByVideo = true;
852
853					$(this).on('ended', function(){
854						if( ls.o.autoPauseSlideshow === 'auto' && ls.g.originalAutoSlideshow === true ){
855							ls.start();
856						}
857					});
858
859					ls.g.isAnimating = false;
860
861					if( ls.g.resize === true ){
862						ls.makeResponsive( ls.g.curLayer, function(){
863							ls.g.resize = false;
864						});
865					}
866				});
867			});
868
869			// NEW FEATURE v1.7 animating first layer
870
871			if( ls.o.animateFirstSlide ){
872				ls.o.firstSlide = ls.o.firstSlide - 1 === 0 ? ls.g.layersNum : ls.o.firstSlide-1;
873			}
874
875			ls.g.curLayerIndex = ls.o.firstSlide;
876			ls.g.curLayer = $(el).find('.ls-slide:eq('+(ls.g.curLayerIndex-1)+')');
877
878			// Moving all layers to .ls-inner container
879
880			$(el).find('.ls-slide').wrapAll('<div class="ls-inner"></div>');
881
882			// NEW FEATURE v4.5.0 Timers
883
884			if( ls.o.showBarTimer ){
885				ls.g.barTimer = $('<div>').addClass('ls-bar-timer').appendTo( $(el).find('.ls-inner') );
886			}
887
888			if( ls.o.showCircleTimer && !ls.g.ie78 ){
889				ls.g.circleTimer = $('<div>').addClass('ls-circle-timer').appendTo( $(el).find('.ls-inner') );
890				ls.g.circleTimer.append( $('<div class="ls-ct-left"><div class="ls-ct-rotate"><div class="ls-ct-hider"><div class="ls-ct-half"></div></div></div></div><div class="ls-ct-right"><div class="ls-ct-rotate"><div class="ls-ct-hider"><div class="ls-ct-half"></div></div></div></div><div class="ls-ct-center"></div>') );
891			}
892
893			// NEW FEATURE v4.0 Adding loading indicator into the element
894
895			ls.g.li = $('<div>').css({
896				zIndex: -1,
897				display: 'none'
898			}).addClass('ls-loading-container').appendTo( $(el) );
899
900			$('<div>').addClass('ls-loading-indicator').appendTo( ls.g.li );
901
902			// Adding styles
903
904			if( $(el).css('position') == 'static' ){
905				$(el).css('position','relative');
906			}
907
908			// IMPROVEMENT & BUGFIX v4.6.0 Fixed transparent global background issue under IE7 & IE8
909
910			if( ls.o.globalBGImage ){
911				$(el).find('.ls-inner').css({
912					backgroundImage : 'url('+ls.o.globalBGImage+')'
913				});
914			}else{
915				$(el).find('.ls-inner').css({
916					backgroundColor : ls.o.globalBGColor
917				});
918			}
919
920			if( ls.o.globalBGColor == 'transparent' && ls.o.globalBGImage == false ){
921				$(el).find('.ls-inner').css({
922					background : 'none transparent !important'
923				});
924			}
925
926			// NEW FEATURES v5.0.0 Lazy-load & remove unnecessary width & height attributes from images
927
928			$(el).find('.ls-slide img').each(function(){
929
930				$(this).removeAttr('width').removeAttr('height');
931
932				if( ls.o.imgPreload === true && ls.o.lazyLoad === true ){
933
934					if( typeof $(this).data('src') !== 'string' ){
935
936						$(this).data('src', $(this).attr('src') );
937						var src = ls.o.skinsPath+'../../img/blank.gif';
938						$(this).attr('src',src);
939					}
940				}else{
941					if( typeof $(this).data('src') === 'string' ){
942
943						$(this).attr('src',$(this).data('src'));
944						$(this).removeAttr('data-src');
945					}
946				}
947
948			});
949
950			// NEW FEATURE v5.0.0 Parallax layers by mousemove
951
952			$(el).find('.ls-slide').on('mouseenter',function(e){
953
954				ls.g.parallaxStartX = e.pageX - $(this).parent().offset().left;
955				ls.g.parallaxStartY = e.pageY - $(this).parent().offset().top;
956			});
957
958			$(el).find('.ls-slide').on('mousemove',function(e){
959
960				var mX0 = $(this).parent().offset().left + ls.g.parallaxStartX;
961				var mY0 = $(this).parent().offset().top + ls.g.parallaxStartY;
962
963				var mX = e.pageX - mX0;
964				var mY = e.pageY - mY0;
965
966				$(this).find('> *:not(.ls-bg)').each(function(){
967
968					if( typeof $(this).data('parallaxlevel') !== 'undefined' && parseInt( $(this).data('parallaxlevel') ) !== 0 ){
969						$(this).css({
970							marginLeft : -mX / 100 * parseInt( $(this).data('parallaxlevel') ),
971							marginTop : -mY / 100 * parseInt( $(this).data('parallaxlevel') )
972						});
973					}
974				});
975			});
976
977			$(el).find('.ls-slide').on('mouseleave',function(){
978
979				$(this).find('> *:not(.ls-bg)').each(function(){
980
981					if( typeof $(this).data('parallaxlevel') !== 'undefined' && parseInt( $(this).data('parallaxlevel') ) !== 0 ){
982						TweenLite.to( this, .4, {css:{
983							marginLeft : 0,
984							marginTop : 0
985							}
986						});
987					}
988				});
989			});
990
991			// Creating navigation
992
993			if( ls.o.navPrevNext ){
994
995				$('<a class="ls-nav-prev" href="#" />').click(function(e){
996					e.preventDefault();
997					$(el).layerSlider('prev');
998				}).appendTo($(el));
999
1000				$('<a class="ls-nav-next" href="#" />').click(function(e){
1001					e.preventDefault();
1002					$(el).layerSlider('next');
1003				}).appendTo($(el));
1004
1005				if( ls.o.hoverPrevNext ){
1006					$(el).find('.ls-nav-prev, .ls-nav-next').css({
1007						display: 'none'
1008					});
1009
1010					$(el).hover(
1011						function(){
1012 							if( !ls.g.forceHideControls ){
1013								if( ls.g.ie78 ){
1014									$(el).find('.ls-nav-prev, .ls-nav-next').css('display','block');
1015								}else{
1016									$(el).find('.ls-nav-prev, .ls-nav-next').stop(true,true).fadeIn(300);
1017								}
1018							}
1019						},
1020						function(){
1021							if( ls.g.ie78 ){
1022								$(el).find('.ls-nav-prev, .ls-nav-next').css('display','none');
1023							}else{
1024								$(el).find('.ls-nav-prev, .ls-nav-next').stop(true,true).fadeOut(300);
1025							}
1026						}
1027					);
1028				}
1029			}
1030
1031			// Creating bottom navigation
1032
1033			if( ls.o.navStartStop || ls.o.navButtons ){
1034
1035				var bottomNav = $('<div class="ls-bottom-nav-wrapper" />').appendTo( $(el) );
1036
1037				ls.g.bottomWrapper = bottomNav;
1038
1039				if( ls.o.thumbnailNavigation == 'always' ){
1040					bottomNav.addClass('ls-above-thumbnails');
1041				}
1042
1043				if( ls.o.navButtons && ls.o.thumbnailNavigation != 'always' ){
1044
1045					$('<span class="ls-bottom-slidebuttons" />').appendTo( $(el).find('.ls-bottom-nav-wrapper') );
1046
1047					// NEW FEATURE v3.5 thumbnailNavigation ('hover')
1048
1049					if( ls.o.thumbnailNavigation == 'hover' ){
1050
1051						var thumbs = $('<div class="ls-thumbnail-hover"><div class="ls-thumbnail-hover-inner"><div class="ls-thumbnail-hover-bg"></div><div class="ls-thumbnail-hover-img"><img></div><span></span></div></div>').appendTo( $(el).find('.ls-bottom-slidebuttons') );
1052					}
1053
1054					for(x=1;x<ls.g.layersNum+1;x++){
1055
1056						var btn = $('<a href="#" />').appendTo( $(el).find('.ls-bottom-slidebuttons') ).click(function(e){
1057							e.preventDefault();
1058							$(el).layerSlider( ($(this).index() + 1) );
1059						});
1060
1061						// NEW FEATURE v3.5 thumbnailNavigation ('hover')
1062
1063						if( ls.o.thumbnailNavigation == 'hover' ){
1064
1065							$(el).find('.ls-thumbnail-hover, .ls-thumbnail-hover-img').css({
1066								width : ls.o.tnWidth,
1067								height : ls.o.tnHeight
1068							});
1069
1070							var th = $(el).find('.ls-thumbnail-hover');
1071
1072							var ti = th.find('img').css({
1073								height : ls.o.tnHeight
1074							});
1075
1076							var thi = $(el).find('.ls-thumbnail-hover-inner').css({
1077								visibility : 'hidden',
1078								display: 'block'
1079							});
1080
1081							btn.hover(
1082								function(){
1083
1084									var hoverLayer = $(el).find('.ls-slide').eq( $(this).index() );
1085									var tnSrc;
1086
1087									if( ls.o.imgPreload === true && ls.o.lazyLoad === true ){
1088
1089										if( hoverLayer.find('.ls-tn').length ){
1090											tnSrc = hoverLayer.find('.ls-tn').data('src');
1091										}else if( hoverLayer.find('.ls-videopreview').length ){
1092											tnSrc = hoverLayer.find('.ls-videopreview').data('src');
1093										}else if( hoverLayer.find('.ls-bg').length ){
1094											tnSrc = hoverLayer.find('.ls-bg').data('src');
1095										}else{
1096											tnSrc = ls.o.skinsPath+ls.o.skin+'/nothumb.png';
1097										}
1098									}else{
1099
1100										if( hoverLayer.find('.ls-tn').length ){
1101											tnSrc = hoverLayer.find('.ls-tn').attr('src');
1102										}else if( hoverLayer.find('.ls-videopreview').length ){
1103											tnSrc = hoverLayer.find('.ls-videopreview').attr('src');
1104										}else if( hoverLayer.find('.ls-bg').length ){
1105											tnSrc = hoverLayer.find('.ls-bg').attr('src');
1106										}else{
1107											tnSrc = ls.o.skinsPath+ls.o.skin+'/nothumb.png';
1108										}
1109									}
1110
1111									$(el).find('.ls-thumbnail-hover-img').css({
1112										left: parseInt( th.css('padding-left') ),
1113										top: parseInt( th.css('padding-top') )
1114									});
1115
1116									ti.load(function(){
1117
1118										if( $(this).width() == 0 ){
1119											ti.css({
1120												position: 'relative',
1121												margin: '0 auto',
1122												left: 'auto'
1123											});
1124										}else{
1125											ti.css({
1126												position: 'absolute',
1127												marginLeft : - $(this).width() / 2,
1128												left: '50%'
1129											});
1130										}
1131									}).attr( 'src', tnSrc );
1132
1133									th.css({
1134										display: 'block'
1135									}).stop().animate({
1136										left: $(this).position().left + ( $(this).width() - th.outerWidth() ) / 2
1137									}, 250 );
1138
1139									thi.css({
1140										display : 'none',
1141										visibility : 'visible'
1142									}).stop().fadeIn(250);
1143								},
1144								function(){
1145									thi.stop().fadeOut(250, function(){
1146										th.css({
1147											visibility : 'hidden',
1148											display: 'block'
1149										});
1150									});
1151								}
1152							);
1153						}
1154					}
1155
1156					if( ls.o.thumbnailNavigation == 'hover' ){
1157
1158						thumbs.appendTo( $(el).find('.ls-bottom-slidebuttons') );
1159					}
1160
1161					$(el).find('.ls-bottom-slidebuttons a:eq('+(ls.o.firstSlide-1)+')').addClass('ls-nav-active');
1162				}
1163
1164				if( ls.o.navStartStop ){
1165
1166					var buttonStart = $('<a class="ls-nav-start" href="#" />').click(function(e){
1167						e.preventDefault();
1168						$(el).layerSlider('start');
1169					}).prependTo( $(el).find('.ls-bottom-nav-wrapper') );
1170
1171					var buttonStop = $('<a class="ls-nav-stop" href="#" />').click(function(e){
1172						e.preventDefault();
1173						$(el).layerSlider('stop');
1174					}).appendTo( $(el).find('.ls-bottom-nav-wrapper') );
1175
1176				}else if( ls.o.thumbnailNavigation != 'always' ){
1177
1178					$('<span class="ls-nav-sides ls-nav-sideleft" />').prependTo( $(el).find('.ls-bottom-nav-wrapper') );
1179					$('<span class="ls-nav-sides ls-nav-sideright" />').appendTo( $(el).find('.ls-bottom-nav-wrapper') );
1180				}
1181
1182				if( ls.o.hoverBottomNav && ls.o.thumbnailNavigation != 'always' ){
1183
1184					bottomNav.css({
1185						display: 'none'
1186					});
1187
1188					$(el).hover(
1189						function(){
1190							if( !ls.g.forceHideControls ){
1191								if( ls.g.ie78 ){
1192									bottomNav.css('display','block');
1193								}else{
1194									bottomNav.stop(true,true).fadeIn(300);
1195								}
1196							}
1197						},
1198						function(){
1199							if( ls.g.ie78 ){
1200								bottomNav.css('display','none');
1201							}else{
1202								bottomNav.stop(true,true).fadeOut(300);
1203							}
1204						}
1205					)
1206				}
1207			}
1208
1209			// NEW FEATURE v3x.5 thumbnailNavigation ('always')
1210
1211			if( ls.o.thumbnailNavigation == 'always' ){
1212
1213				ls.g.thumbsWrapper = $('<div class="ls-thumbnail-wrapper"></div>').appendTo( $(el) );
1214				var thumbs = $('<div class="ls-thumbnail"><div class="ls-thumbnail-inner"><div class="ls-thumbnail-slide-container"><div class="ls-thumbnail-slide"></div></div></div></div>').appendTo( ls.g.thumbsWrapper );
1215
1216				ls.g.thumbnails = $(el).find('.ls-thumbnail-slide-container');
1217
1218				if( !('ontouchstart' in window) ){
1219					ls.g.thumbnails.hover(
1220						function(){
1221							$(this).addClass('ls-thumbnail-slide-hover');
1222						},
1223						function(){
1224							$(this).removeClass('ls-thumbnail-slide-hover');
1225							ls.scrollThumb();
1226						}
1227					).mousemove(function(e){
1228
1229						var mL = parseInt(e.pageX - $(this).offset().left ) / $(this).width() * ( $(this).width() - $(this).find('.ls-thumbnail-slide').width() );
1230						$(this).find('.ls-thumbnail-slide').stop().css({
1231							marginLeft : mL
1232						});
1233					});
1234				}else{
1235					ls.g.thumbnails.addClass('ls-touchscroll');
1236				}
1237
1238				$(el).find('.ls-slide').each(function(){
1239
1240					var tempIndex = $(this).index() + 1;
1241					var tnSrc;
1242
1243					if( ls.o.imgPreload === true && ls.o.lazyLoad === true ){
1244
1245						if( $(this).find('.ls-tn').length ){
1246							tnSrc = $(this).find('.ls-tn').data('src');
1247						}else if( $(this).find('.ls-videopreview').length ){
1248							tnSrc = $(this).find('.ls-videopreview').data('src');
1249						}else if( $(this).find('.ls-bg').length ){
1250							tnSrc = $(this).find('.ls-bg').data('src');
1251						}else{
1252							tnSrc = ls.o.skinsPath+ls.o.skin+'/nothumb.png';
1253						}
1254					}else{
1255
1256						if( $(this).find('.ls-tn').length ){
1257							tnSrc = $(this).find('.ls-tn').attr('src');
1258						}else if( $(this).find('.ls-videopreview').length ){
1259							tnSrc = $(this).find('.ls-videopreview').attr('src');
1260						}else if( $(this).find('.ls-bg').length ){
1261							tnSrc = $(this).find('.ls-bg').attr('src');
1262						}else{
1263							tnSrc = ls.o.skinsPath+ls.o.skin+'/nothumb.png';
1264						}
1265					}
1266
1267					var thumb = $('<a href="#" class="ls-thumb-' + tempIndex + '"><img src="'+tnSrc+'"></a>');
1268					thumb.appendTo( $(el).find('.ls-thumbnail-slide') );
1269
1270					if( !('ontouchstart' in window) ){
1271
1272						thumb.hover(
1273							function(){
1274								$(this).children().stop().fadeTo(300,ls.o.tnActiveOpacity/100);
1275							},
1276							function(){
1277								if( !$(this).children().hasClass('ls-thumb-active') ){
1278									$(this).children().stop().fadeTo(300,ls.o.tnInactiveOpacity/100);
1279								}
1280							}
1281						);
1282					}
1283
1284					thumb.click(function(e){
1285						e.preventDefault();
1286						$(el).layerSlider( tempIndex );
1287					});
1288				});
1289
1290				if( buttonStart && buttonStop ){
1291					var lsBottomBelowTN = ls.g.bottomWrapper = $('<div class="ls-bottom-nav-wrapper ls-below-thumbnails"></div>').appendTo( $(el) );
1292					buttonStart.clone().click(function(e){
1293						e.preventDefault();
1294						$(el).layerSlider('start');
1295					}).appendTo( lsBottomBelowTN );
1296					buttonStop.clone().click(function(e){
1297						e.preventDefault();
1298						$(el).layerSlider('stop');
1299					}).appendTo( lsBottomBelowTN );
1300				}
1301
1302				if( ls.o.hoverBottomNav ){
1303
1304					ls.g.thumbsWrapper.css('display','none');
1305
1306					if( lsBottomBelowTN ){
1307						ls.g.bottomWrapper = lsBottomBelowTN.css('display') == 'block' ? lsBottomBelowTN : $(el).find('.ls-above-thumbnails');
1308						ls.g.bottomWrapper.css('display','none');
1309					}
1310
1311					// BUGFIXES v4.1.3 Added checking of the bottomWrapper variable
1312
1313					$(el).hover(
1314						function(){
1315							$(el).addClass('ls-hover');
1316							if( !ls.g.forceHideControls ){
1317								if( ls.g.ie78 ){
1318									ls.g.thumbsWrapper.css('display','block');
1319									if( ls.g.bottomWrapper ){
1320										ls.g.bottomWrapper.css('display','block');
1321									}
1322								}else{
1323									ls.g.thumbsWrapper.stop(true,true).fadeIn(300);
1324									if( ls.g.bottomWrapper ){
1325										ls.g.bottomWrapper.stop(true,true).fadeIn(300);
1326									}
1327								}
1328							}
1329						},
1330						function(){
1331							$(el).removeClass('ls-hover');
1332							if( ls.g.ie78 ){
1333								ls.g.thumbsWrapper.css('display','none');
1334								if( ls.g.bottomWrapper ){
1335									ls.g.bottomWrapper.css('display','none');
1336								}
1337							}else{
1338								ls.g.thumbsWrapper.stop(true,true).fadeOut(300);
1339								if( ls.g.bottomWrapper ){
1340									ls.g.bottomWrapper.stop(true,true).fadeOut(300);
1341								}
1342							}
1343						}
1344					)
1345				}
1346			}
1347
1348			// Adding shadow wrapper
1349
1350			ls.g.shadow = $('<div class="ls-shadow"></div>').appendTo( $(el) );
1351			if( ls.g.shadow.css('display') == 'block' && !ls.g.shadow.find('img').length ){
1352				ls.g.showShadow = function(){
1353					ls.g.shadow.css({
1354						display: 'none',
1355						visibility: 'visible'
1356					}).fadeIn( 500, function(){
1357						ls.g.showShadow = false;
1358					});
1359				}
1360				var imgPath = 'modules/wtslideshow/views/img/skin/';
1361				ls.g.shadowImg = $('<img>').attr('src',imgPath+ls.o.skin+'/shadow.png').appendTo( ls.g.shadow );
1362				ls.g.shadowBtmMod = typeof parseInt( $(el).css('padding-bottom') ) == 'number' ? parseInt( $(el).css('padding-bottom') ) : 0;
1363			}
1364			ls.resizeShadow();
1365
1366			// Adding keyboard navigation if turned on and if number of layers > 1
1367
1368			if( ls.o.keybNav && $(el).find('.ls-slide').length > 1 ){
1369
1370				$('body').bind('keydown',function(e){
1371					if( !ls.g.isAnimating && !ls.g.isLoading ){
1372						if( e.which == 37 ){
1373							ls.o.cbPrev(ls.g);
1374							ls.prev('clicked');
1375						}else if( e.which == 39 ){
1376							ls.o.cbNext(ls.g);
1377							ls.next('clicked');
1378						}
1379					}
1380				});
1381			}
1382
1383			// Adding touch-control navigation if number of layers > 1
1384
1385			if('ontouchstart' in window && $(el).find('.ls-slide').length > 1 && ls.o.touchNav ){
1386
1387			   $(el).find('.ls-inner').bind('touchstart', function( e ) {
1388					var t = e.touches ? e.touches : e.originalEvent.touches;
1389					if( t.length == 1 ){
1390						ls.g.touchStartX = ls.g.touchEndX = t[0].clientX;
1391					}
1392			    });
1393
1394			   $(el).find('.ls-inner').bind('touchmove', function( e ) {
1395					var t = e.touches ? e.touches : e.originalEvent.touches;
1396					if( t.length == 1 ){
1397						ls.g.touchEndX = t[0].clientX;
1398					}
1399					if( Math.abs( ls.g.touchStartX - ls.g.touchEndX ) > 45 ){
1400						e.preventDefault();
1401					}
1402			    });
1403
1404				$(el).find('.ls-inner').bind('touchend',function( e ){
1405					if( Math.abs( ls.g.touchStartX - ls.g.touchEndX ) > 45 ){
1406						if( ls.g.touchStartX - ls.g.touchEndX > 0 ){
1407							ls.o.cbNext(ls.g);
1408							$(el).layerSlider('next');
1409						}else{
1410							ls.o.cbPrev(ls.g);
1411							$(el).layerSlider('prev');
1412						}
1413					}
1414				});
1415			}
1416
1417			// Feature: pauseOnHover (if number of layers > 1)
1418
1419			if( ls.o.pauseOnHover == true && $(el).find('.ls-slide').length > 1 ){
1420
1421				// BUGFIX v1.6 stop was not working because of pause on hover
1422
1423				$(el).find('.ls-inner').hover(
1424					function(){
1425
1426						// Calling cbPause callback function
1427
1428						ls.o.cbPause(ls.g);
1429						if( ls.g.autoSlideshow ){
1430							ls.g.paused = true;
1431							ls.stop();
1432
1433							// Stopping the animation of Timers
1434
1435							if( ls.g.barTimer ){
1436								ls.g.barTimer.stop();
1437							}
1438
1439							if( ls.g.circleTimer ){
1440								if( ls.g.cttl ){
1441									ls.g.cttl.pause();
1442								}
1443							}
1444							ls.g.pausedSlideTime = new Date().getTime();
1445						}
1446					},
1447					function(){
1448						if( ls.g.paused == true ){
1449							ls.start();
1450							ls.g.paused = false;
1451						}
1452					}
1453				);
1454			}
1455
1456			ls.resizeSlider();
1457
1458			// NEW FEATURE v1.7 added yourLogo
1459
1460			if( ls.o.yourLogo ){
1461				ls.g.yourLogo = $('<img>').addClass('ls-yourlogo').appendTo($(el)).attr('style', ls.o.yourLogoStyle ).css({
1462					visibility: 'hidden',
1463					display: 'bock'
1464				}).load(function(){
1465
1466					// NEW FEATURE v3.0 added responsive yourLogo
1467
1468					var logoTimeout = 0;
1469
1470					if( !ls.g.yourLogo ){
1471						logoTimeout = 1000;
1472					}
1473
1474					setTimeout( function(){
1475
1476						ls.g.yourLogo.data( 'originalWidth', ls.g.yourLogo.width() );
1477						ls.g.yourLogo.data( 'originalHeight', ls.g.yourLogo.height() );
1478						if( ls.g.yourLogo.css('left') != 'auto' ){
1479							ls.g.yourLogo.data( 'originalLeft', ls.g.yourLogo[0].style.left );
1480						}
1481						if( ls.g.yourLogo.css('right') != 'auto' ){
1482							ls.g.yourLogo.data( 'originalRight', ls.g.yourLogo[0].style.right );
1483						}
1484						if( ls.g.yourLogo.css('top') != 'auto' ){
1485							ls.g.yourLogo.data( 'originalTop', ls.g.yourLogo[0].style.top );
1486						}
1487						if( ls.g.yourLogo.css('bottom') != 'auto' ){
1488							ls.g.yourLogo.data( 'originalBottom', ls.g.yourLogo[0].style.bottom );
1489						}
1490
1491						// NEW FEATURES v1.8 added yourLogoLink & yourLogoTarget
1492
1493						if( ls.o.yourLogoLink != false ){
1494							$('<a>').appendTo($(el)).attr( 'href', ls.o.yourLogoLink ).attr('target', ls.o.yourLogoTarget ).css({
1495								textDecoration : 'none',
1496								outline : 'none'
1497							}).append( ls.g.yourLogo );
1498						}
1499
1500						ls.g.yourLogo.css({
1501							display: 'none',
1502							visibility: 'visible'
1503						});
1504
1505						ls.resizeYourLogo();
1506
1507					}, logoTimeout );
1508
1509				}).attr( 'src', ls.o.yourLogo );
1510			}
1511
1512			// NEW FEATURE v1.7 added window resize function for make responsive layout better
1513
1514			$(window).resize(function(){
1515
1516				ls.g.resize = true;
1517
1518				if( !ls.g.isAnimating ){
1519
1520					ls.makeResponsive( ls.g.curLayer, function(){
1521						if( ls.g.ltContainer ){
1522							ls.g.ltContainer.empty();
1523						}
1524						ls.g.resize = false;
1525					});
1526					if( ls.g.yourLogo ){
1527						ls.resizeYourLogo();
1528					}
1529				}
1530			});
1531
1532			ls.g.showSlider = true;
1533
1534			// NEW FEATURE v1.7 animating first layer
1535
1536			if( ls.o.animateFirstSlide == true ){
1537				if( ls.o.autoStart ){
1538					ls.g.autoSlideshow = true;
1539					$(el).find('.ls-nav-start').addClass('ls-nav-start-active');
1540				}else{
1541					$(el).find('.ls-nav-stop').addClass('ls-nav-stop-active');
1542				}
1543				ls.next();
1544			}else{
1545				ls.imgPreload(ls.g.curLayer,function(){
1546					ls.g.curLayer.fadeIn(1000, function(){
1547
1548						ls.g.isLoading = false;
1549
1550						$(this).addClass('ls-active');
1551
1552						// NEW FEATURE v2.0 autoPlayVideos
1553
1554						if( ls.o.autoPlayVideos ){
1555							$(this).delay( $(this).data('delayin') + 25 ).queue(function(){
1556								$(this).find('.ls-videopreview, video, audio').click();
1557								$(this).dequeue();
1558							});
1559						}
1560
1561						// NEW FEATURE v3.0 showUntil sublayers
1562
1563						ls.g.curLayer.find(' > *[class*="ls-l"]').each(function(){
1564
1565							// Setting showUntilTimers
1566
1567							if( $(this).data('showuntil') > 0 ){
1568
1569								var cursub = $(this);
1570
1571								// IMPROVEMENT v4.5.0 sublayerShowUntil will be called anly if necessary
1572
1573								cursub.data('showUntilTimer', setTimeout(function(){
1574									ls.sublayerShowUntil( cursub );
1575								}, cursub.data('showuntil') ));
1576							}
1577						});
1578					});
1579
1580					ls.changeThumb(ls.g.curLayerIndex)
1581
1582					// If autoStart is true
1583
1584					if( ls.o.autoStart ){
1585						ls.g.isLoading = false;
1586						ls.start();
1587					}else{
1588						$(el).find('.ls-nav-stop').addClass('ls-nav-stop-active');
1589					}
1590				});
1591			}
1592
1593			// NEW FEATURE v1.7 added cbInit function
1594
1595			ls.o.cbInit($(el));
1596		};
1597
1598		ls.start = function(){
1599
1600			if( ls.g.autoSlideshow ){
1601				if( ls.g.prevNext == 'prev' && ls.o.twoWaySlideshow ){
1602					ls.prev();
1603				}else{
1604					ls.next();
1605				}
1606			}else{
1607				ls.g.autoSlideshow = true;
1608				if( !ls.g.isAnimating && !ls.g.isLoading ){
1609					ls.timer();
1610				}
1611			}
1612
1613			$(el).find('.ls-nav-start').addClass('ls-nav-start-active');
1614			$(el).find('.ls-nav-stop').removeClass('ls-nav-stop-active');
1615		};
1616
1617		ls.timer = function(){
1618
1619			if( $(el).find('.ls-active').data('ls') ){
1620				var sD = ls.st.slideDelay;
1621			}else{
1622				var sD = ls.o.slideDelay;
1623			}
1624
1625			var delaytime = $(el).find('.ls-active').data('slidedelay') ? parseInt( $(el).find('.ls-active').data('slidedelay') ) : sD;
1626
1627			// BUGFIX v3.0 delaytime did not work on first layer if animateFirstSlide was set to off
1628			// BUGFIX v3.5 delaytime did not work on all layers in standalone version after bugfix 3.0 :)
1629
1630			if( !ls.o.animateFirstSlide && !$(el).find('.ls-active').data('slidedelay') ){
1631				var tempD = $(el).find('.ls-slide:eq('+(ls.o.firstSlide-1)+')').data('slidedelay');
1632				delaytime = tempD ? tempD : sD;
1633			}
1634
1635			clearTimeout( ls.g.slideTimer );
1636
1637			// NEW FEATURE v4.5.0 Timers
1638
1639			if( ls.g.pausedSlideTime ){
1640				if( !ls.g.startSlideTime ){
1641					ls.g.startSlideTime = new Date().getTime();
1642				}
1643				if( ls.g.startSlideTime > ls.g.pausedSlideTime ){
1644					ls.g.pausedSlideTime =  new Date().getTime();
1645				}
1646				if(! ls.g.curSlideTime ){
1647					ls.g.curSlideTime = delaytime;
1648				}
1649				ls.g.curSlideTime -= (ls.g.pausedSlideTime - ls.g.startSlideTime);
1650				ls.g.pausedSlideTime = false;
1651				ls.g.startSlideTime = new Date().getTime();
1652			}else{
1653				ls.g.curSlideTime = delaytime;
1654				ls.g.startSlideTime = new Date().getTime();
1655			}
1656
1657			// BUGFIX v4.6.0 fixed Bar Timer animation on the fisrt slide if animateFirstSlide is false
1658
1659			ls.g.curSlideTime = parseInt( ls.g.curSlideTime );
1660
1661			ls.g.slideTimer = setTimeout(function(){
1662				ls.g.startSlideTime = ls.g.pausedSlideTime = ls.g.curSlideTime = false;
1663				ls.start();
1664			}, ls.g.curSlideTime );
1665
1666			// Animating Timers
1667
1668			if( ls.g.barTimer ){
1669				ls.g.barTimer.animate({
1670					width : ls.g.sliderWidth()
1671				}, ls.g.curSlideTime, 'linear', function(){
1672					$(this).css({
1673						width: 0
1674					});
1675				});
1676			}
1677
1678			if( ls.g.circleTimer ){
1679
1680				var ct1 = ls.g.circleTimer.find('.ls-ct-right .ls-ct-rotate');
1681				var ct2 = ls.g.circleTimer.find('.ls-ct-left .ls-ct-rotate');
1682
1683				if( ls.g.circleTimer.css('display') == 'none' ){
1684
1685					ct1.css({
1686						rotate : 0
1687					});
1688
1689					ct2.css({
1690						rotate : 0
1691					});
1692
1693					ls.g.circleTimer.fadeIn(350);
1694				}
1695
1696				if( !ls.g.cttl ){
1697					ls.g.cttl = new TimelineLite();
1698					ls.g.cttl.add( TweenLite.fromTo(ct1[0],delaytime/2000,{
1699						rotation : 0
1700					},{
1701						ease : Linear.easeNone,
1702						rotation : 180,
1703						onReverseComplete : function(){
1704							ls.g.cttl = false;
1705						}
1706					}));
1707					ls.g.cttl.add( TweenLite.fromTo(ct2[0],delaytime/2000,{
1708						rotation : 0
1709					},{
1710						ease : Linear.easeNone,
1711						rotation : 180
1712					}));
1713				}else{
1714					ls.g.cttl.resume();
1715				}
1716
1717			}
1718		};
1719
1720		ls.stop = function(){
1721
1722			// Stopping Timers
1723
1724			ls.g.pausedSlideTime = new Date().getTime();
1725
1726			if( ls.g.barTimer ){
1727				ls.g.barTimer.stop();
1728			}
1729
1730			if( ls.g.circleTimer ){
1731				if( ls.g.cttl ){
1732					ls.g.cttl.pause();
1733				}
1734			}
1735
1736			if( !ls.g.paused && !ls.g.originalAutoSlideshow ){
1737				$(el).find('.ls-nav-stop').addClass('ls-nav-stop-active');
1738				$(el).find('.ls-nav-start').removeClass('ls-nav-start-active');
1739			}
1740			clearTimeout( ls.g.slideTimer );
1741			ls.g.autoSlideshow = false;
1742		};
1743
1744		ls.forcestop = function(){
1745
1746			clearTimeout( ls.g.slideTimer );
1747			ls.g.autoSlideshow = false;
1748
1749			clearTimeout( ls.g.t1 );
1750			clearTimeout( ls.g.t2 );
1751			clearTimeout( ls.g.t3 );
1752			clearTimeout( ls.g.t4 );
1753			clearTimeout( ls.g.t5 );
1754
1755			if( ls.g.barTimer ){
1756				ls.g.barTimer.stop();
1757			}
1758
1759			if( ls.g.circleTimer ){
1760				if( ls.g.cttl ){
1761					ls.g.cttl.pause();
1762				}
1763			}
1764
1765			$(el).find('*').stop(true,false).dequeue();
1766			$(el).find('.ls-slide >').each(function(){
1767				if( $(this).data('tr') ){
1768					$(this).data('tr').pause();
1769				}
1770			});
1771
1772			if( !ls.g.paused && !ls.g.originalAutoSlideshow ){
1773				$(el).find('.ls-nav-stop').addClass('ls-nav-stop-active');
1774				$(el).find('.ls-nav-start').removeClass('ls-nav-start-active');
1775			}
1776		};
1777
1778		ls.restart = function(){
1779
1780			$(el).find('*').stop();
1781			clearTimeout( ls.g.slideTimer );
1782			ls.change(ls.g.curLayerIndex,ls.g.prevNext);
1783		};
1784
1785		// Because of an ie7 bug, we have to check & format the strings correctly
1786
1787		ls.ieEasing = function( e ){
1788
1789			// BUGFIX v1.6 and v1.8 some type of animations didn't work properly
1790
1791			if( $.trim(e.toLowerCase()) == 'swing' || $.trim(e.toLowerCase()) == 'linear'){
1792				return e.toLowerCase();
1793			}else{
1794				return e.replace('easeinout','easeInOut').replace('easein','easeIn').replace('easeout','easeOut').replace('quad','Quad').replace('quart','Quart').replace('cubic','Cubic').replace('quint','Quint').replace('sine','Sine').replace('expo','Expo').replace('circ','Circ').replace('elastic','Elastic').replace('back','Back').replace('bounce','Bounce');
1795			}
1796		};
1797
1798		// Calculating prev layer
1799
1800		ls.prev = function(clicked){
1801
1802			// NEW FEATURE v2.0 loops
1803
1804			if( ls.g.curLayerIndex < 2 ){
1805				ls.g.nextLoop += 1;
1806			}
1807
1808			if( ( ls.g.nextLoop > ls.o.loops ) && ( ls.o.loops > 0 ) && !clicked ){
1809				ls.g.nextLoop = 0;
1810				ls.stop();
1811				if( ls.o.forceLoopNum == false ){
1812					ls.o.loops = 0;
1813				}
1814			}else{
1815				var prev = ls.g.curLayerIndex < 2 ? ls.g.layersNum : ls.g.curLayerIndex - 1;
1816				ls.g.prevNext = 'prev';
1817				ls.change(prev,ls.g.prevNext);
1818			}
1819		};
1820
1821		// Calculating next layer
1822
1823		ls.next = function(clicked){
1824
1825			// NEW FEATURE v2.0 loops
1826
1827			if( !ls.o.randomSlideshow ){
1828
1829				if( !(ls.g.curLayerIndex < ls.g.layersNum) ){
1830					ls.g.nextLoop += 1;
1831				}
1832
1833				if( ( ls.g.nextLoop > ls.o.loops ) && ( ls.o.loops > 0 ) && !clicked ){
1834
1835					ls.g.nextLoop = 0;
1836					ls.stop();
1837					if( ls.o.forceLoopNum == false ){
1838						ls.o.loops = 0;
1839					}
1840				}else{
1841
1842					var next = ls.g.curLayerIndex < ls.g.layersNum ? ls.g.curLayerIndex + 1 : 1;
1843					ls.g.prevNext = 'next';
1844					ls.change(next,ls.g.prevNext);
1845				}
1846			}else if( !clicked ){
1847
1848				// NEW FEATURE v3.5 randomSlideshow
1849
1850				var next = ls.g.curLayerIndex;
1851
1852				var calcRand = function(){
1853
1854					next = Math.floor(Math.random() * ls.g.layersNum) + 1;
1855
1856					if( next == ls.g.curLayerIndex ){
1857
1858						calcRand();
1859					}else{
1860						ls.g.prevNext = 'next';
1861						ls.change(next,ls.g.prevNext);
1862					}
1863				}
1864
1865				calcRand();
1866			}else if( clicked ){
1867
1868				var next = ls.g.curLayerIndex < ls.g.layersNum ? ls.g.curLayerIndex + 1 : 1;
1869				ls.g.prevNext = 'next';
1870				ls.change(next,ls.g.prevNext);
1871			}
1872
1873		};
1874
1875		ls.change = function(num,prevnext){
1876
1877			// Stopping Timers if needed
1878
1879			ls.g.startSlideTime = ls.g.pausedSlideTime = ls.g.curSlideTime = false;
1880
1881			// IMPROVEMENT v4.6.0 Bar Timer animation
1882
1883			if( ls.g.barTimer ){
1884				ls.g.barTimer.stop().delay(300).animate({
1885					width: 0
1886				},450);
1887			}
1888			if( ls.g.circleTimer ){
1889				ls.g.circleTimer.fadeOut(500);
1890				if( ls.g.cttl ){
1891					ls.g.cttl.reverse().duration(.35);
1892				}
1893			}
1894
1895			// NEW FEATURE v2.0 videoPreview & autoPlayVideos
1896
1897			if( ls.g.pausedByVideo == true ){
1898
1899				ls.g.pausedByVideo = false;
1900				ls.g.autoSlideshow = ls.g.originalAutoSlideshow;
1901
1902				ls.g.curLayer.find('iframe[src*="www.youtu"], iframe[src*="player.vimeo"]').each(function(){
1903
1904					$(this).parent().find('.ls-vpcontainer').fadeIn(ls.g.v.fi,function(){
1905						$(this).parent().find('iframe').attr('src','');
1906					});
1907				});
1908
1909				ls.g.curLayer.find('video, audio').each(function(){
1910
1911					this.pause();
1912				});
1913			}
1914
1915			$(el).find('iframe[src*="www.youtu"], iframe[src*="player.vimeo"]').each(function(){
1916
1917				// Clearing videoTimeouts
1918
1919				clearTimeout( $(this).data( 'videoTimer') );
1920			});
1921
1922			clearTimeout( ls.g.slideTimer );
1923			ls.g.nextLayerIndex = num;
1924			ls.g.nextLayer = $(el).find('.ls-slide:eq('+(ls.g.nextLayerIndex-1)+')');
1925
1926			// BUGFIX v1.6 fixed wrong directions of animations if navigating by slidebuttons
1927
1928			if( !prevnext ){
1929
1930				if( ls.g.curLayerIndex < ls.g.nextLayerIndex ){
1931					ls.g.prevNext = 'next';
1932				}else{
1933					ls.g.prevNext = 'prev';
1934				}
1935			}
1936
1937			// Added timeOut to wait for the fade animation of videoPreview image...
1938
1939			var timeOut = 0;
1940
1941			if( $(el).find('iframe[src*="www.youtu"], iframe[src*="player.vimeo"]').length > 0 ){
1942				timeOut = ls.g.v.fi;
1943			}
1944
1945			ls.imgPreload(ls.g.nextLayer,function(){
1946				ls.animate();
1947			});
1948		};
1949
1950		// Preloading images
1951
1952		ls.imgPreload = function(layer,callback){
1953
1954			ls.g.isLoading = true;
1955
1956			// Showing slider for the first time
1957
1958			if( ls.g.showSlider ){
1959				$(el).css({
1960					visibility : 'visible'
1961				});
1962			}
1963
1964			// If image preload is on
1965
1966			if( ls.o.imgPreload ){
1967
1968				var preImages = [];
1969				var preloaded = 0;
1970
1971				// NEW FEATURE v1.8 Preloading background images of layers
1972
1973				if( layer.css('background-image') != 'none' && layer.css('background-image').indexOf('url') != -1 && !layer.hasClass('ls-preloaded') && !layer.hasClass('ls-not-preloaded') ){
1974					var bgi = layer.css('background-image');
1975					bgi = bgi.match(/url\((.*)\)/)[1].replace(/"/gi, '');
1976					preImages[preImages.length] = [bgi, layer];
1977				}
1978
1979				// Images inside layers
1980
1981				layer.find('img:not(.ls-preloaded, .ls-not-preloaded)').each(function(){
1982
1983					// NEW FEATURE v5.0.0 Lazy-load
1984
1985					if( ls.o.lazyLoad === true ){
1986						$(this).attr('src',$(this).data('src'));
1987					}
1988					preImages[preImages.length] = [$(this).attr('src'), $(this)];
1989				});
1990
1991				// Background images inside layers
1992
1993				layer.find('*').each(function(){
1994
1995					// BUGFIX v1.7 fixed preload bug with sublayers with gradient backgrounds
1996
1997					if( $(this).css('background-image') != 'none' && $(this).css('background-image').indexOf('url') != -1 && !$(this).hasClass('ls-preloaded') && !$(this).hasClass('ls-not-preloaded') ){
1998						var bgi = $(this).css('background-image');
1999						bgi = bgi.match(/url\((.*)\)/)[1].replace(/"/gi, '');
2000						preImages[preImages.length] = [bgi, $(this)];
2001					}
2002				});
2003
2004				// BUGFIX v1.7 if there are no images in a layer, calling the callback function
2005
2006				if(preImages.length == 0){
2007
2008					$('.ls-thumbnail-wrapper, .ls-nav-next, .ls-nav-prev, .ls-bottom-nav-wrapper').css({
2009						visibility : 'visible'
2010					});
2011
2012					ls.makeResponsive(layer, callback);
2013				}else{
2014
2015					// NEW FEATURE v4.0 Showing loading indicator
2016
2017					if( ls.g.ie78 ){
2018						ls.g.li.css('display','block');
2019					}else{
2020
2021						// BUGIFX v4.1.3 Adding delay to the showing of the loading indicator
2022
2023						ls.g.li.delay(400).fadeIn(300);
2024					}
2025
2026					for(x=0;x<preImages.length;x++){
2027
2028						$('<img>').data('el',preImages[x]).load(function(){
2029
2030							$(this).data('el')[1].addClass('ls-preloaded');
2031
2032							if( ++preloaded == preImages.length ){
2033
2034							// NEW FEATURE v4.0 Hiding loading indicator
2035
2036								ls.g.li.stop(true,true).css({
2037									display: 'none'
2038								});
2039
2040								$('.ls-thumbnail-wrapper, .ls-nav-next, .ls-nav-prev, .ls-bottom-nav-wrapper').css({
2041									visibility : 'visible'
2042								});
2043
2044								// We love you so much IE... -.-
2045
2046								if( navigator.userAgent.indexOf('Trident/7') !== -1 || ls.g.ie78 ){
2047									setTimeout(function(){
2048										ls.makeResponsive(layer, callback);
2049									},50);
2050								}else{
2051									ls.makeResponsive(layer, callback);
2052								}
2053							}
2054						}).error(function(){
2055							var imgURL = $(this).data('el')[0].substring($(this).data('el')[0].lastIndexOf("/") + 1, $(this).data('el')[0].length);
2056							if( window.console ){
2057								console.log('LayerSlider error:\r\n\r\nIt seems like the URL of the image or background image "'+imgURL+'" is pointing to a wrong location and it cannot be loaded. Please check the URLs of all your images used in the slider.');
2058							}else{
2059								alert('LayerSlider error:\r\n\r\nIt seems like the URL of the image or background image "'+imgURL+'" is pointing to a wrong location and it cannot be loaded. Please check the URLs of all your images used in the slider.');
2060							}
2061							$(this).addClass('ls-not-preloaded');
2062							preloaded++;
2063						}).attr('src',preImages[x][0]);
2064					}
2065				}
2066			}else{
2067
2068				$('.ls-thumbnail-wrapper, .ls-nav-next, .ls-nav-prev, .ls-bottom-nav-wrapper').css({
2069					visibility : 'visible'
2070				});
2071
2072				ls.makeResponsive(layer, callback);
2073			}
2074		};
2075
2076		// NEW FEATURE v1.7 making the slider responsive
2077
2078		ls.makeResponsive = function(layer, callback ){
2079
2080			layer.css({
2081				visibility: 'hidden',
2082				display: 'block'
2083			});
2084
2085			if( ls.g.showShadow ){
2086				ls.g.showShadow();
2087			}
2088			ls.resizeSlider();
2089
2090			if( ls.o.thumbnailNavigation == 'always' ){
2091				ls.resizeThumb();
2092			}
2093			layer.children().each(function(){
2094
2095				var sl = $(this);
2096
2097				// positioning
2098
2099				var ol = sl.data('originalLeft') ? sl.data('originalLeft') : '0';
2100				var ot = sl.data('originalTop') ? sl.data('originalTop') : '0';
2101
2102				if( sl.is('a') && sl.children().length > 0 ){
2103					sl.css({
2104						display : 'block'
2105					});
2106					sl = sl.children();
2107				}
2108
2109				var ow = 'auto';
2110				var oh = 'auto';
2111
2112				if( sl.data('originalWidth') ){
2113
2114					if( typeof sl.data('originalWidth') == 'number' ){
2115						ow = parseInt( sl.data('originalWidth') ) * ls.g.ratio;
2116					}else if( sl.data('originalWidth').indexOf('%') != -1 ){
2117						ow = sl.data('originalWidth');
2118					}
2119				}
2120
2121				if( sl.data('originalHeight') ){
2122					if( typeof sl.data('originalHeight') == 'number' ){
2123						oh = parseInt( sl.data('originalHeight') ) * ls.g.ratio;
2124					}else if( sl.data('originalHeight').indexOf('%') != -1 ){
2125						oh = sl.data('originalHeight');
2126					}
2127				}
2128
2129				// padding
2130
2131				var opl = sl.data('originalPaddingLeft') ? parseInt( sl.data('originalPaddingLeft') ) * ls.g.ratio : 0;
2132				var opr = sl.data('originalPaddingRight') ? parseInt( sl.data('originalPaddingRight') ) * ls.g.ratio : 0;
2133				var opt = sl.data('originalPaddingTop') ? parseInt( sl.data('originalPaddingTop') ) * ls.g.ratio : 0;
2134				var opb = sl.data('originalPaddingBottom') ? parseInt( sl.data('originalPaddingBottom') ) * ls.g.ratio : 0;
2135
2136				// border
2137
2138				var obl = sl.data('originalBorderLeft') ? parseInt( sl.data('originalBorderLeft') ) * ls.g.ratio : 0;
2139				var obr = sl.data('originalBorderRight') ? parseInt( sl.data('originalBorderRight') ) * ls.g.ratio : 0;
2140				var obt = sl.data('originalBorderTop') ? parseInt( sl.data('originalBorderTop') ) * ls.g.ratio : 0;
2141				var obb = sl.data('originalBorderBottom') ? parseInt( sl.data('originalBorderBottom') ) * ls.g.ratio : 0;
2142
2143				// font
2144
2145				var ofs = sl.data('originalFontSize');
2146				var olh = sl.data('originalLineHeight');
2147
2148				// NEW FEATURE v3.0 added "normal" responsive mode with image and font resizing
2149				// NEW FEATURE v3.5 added responsiveUnder
2150
2151				if( ls.g.responsiveMode || ls.o.responsiveUnder > 0 ){
2152
2153					if( sl.is('img') && !sl.hasClass('ls-bg') && sl.attr('src') ){
2154
2155						sl.css({
2156							width: 'auto',
2157							height: 'auto'
2158						});
2159
2160						// IMPROVEMENT v4.5.0 Images can have now starting width / height
2161
2162						if( ( ow == 0 || ow == 'auto' ) && typeof oh == 'number' && oh != 0 ){
2163							ow = ( oh / sl.height() ) * sl.width();
2164						}
2165
2166						if( ( oh == 0 || oh == 'auto' ) && typeof ow == 'number' && ow != 0 ){
2167							oh = ( ow / sl.width() ) * sl.height();
2168						}
2169
2170						if( ow == 'auto'){
2171							ow = sl.width() * ls.g.ratio;
2172						}
2173
2174						if( oh == 'auto'){
2175							oh = sl.height() * ls.g.ratio;
2176						}
2177
2178						sl.css({
2179							width : ow,
2180							height : oh
2181						});
2182					}
2183
2184					if( !sl.is('img') ){
2185						sl.css({
2186							width : ow,
2187							height : oh,
2188							'font-size' : parseInt(ofs) * ls.g.ratio +'px',
2189							'line-height' : parseInt(olh) * ls.g.ratio + 'px'
2190						});
2191					}
2192
2193					if( sl.is('div') && sl.find('iframe').data('videoSrc') ){
2194
2195						var videoIframe = sl.find('iframe');
2196						videoIframe.attr('width', parseInt( videoIframe.data('originalWidth') ) * ls.g.ratio ).attr('height', parseInt( videoIframe.data('originalHeight') ) * ls.g.ratio );
2197
2198						sl.css({
2199							width : parseInt( videoIframe.data('originalWidth') ) * ls.g.ratio,
2200							height : parseInt( videoIframe.data('originalHeight') ) * ls.g.ratio
2201						});
2202					}
2203
2204					sl.css({
2205						padding : opt + 'px ' + opr + 'px ' + opb + 'px ' + opl + 'px ',
2206						borderLeftWidth : obl + 'px',
2207						borderRightWidth : obr + 'px',
2208						borderTopWidth : obt + 'px',
2209						borderBottomWidth : obb + 'px'
2210					});
2211				}
2212
2213				// If it is NOT a bg sublayer
2214
2215				if( !sl.hasClass('ls-bg') ){
2216
2217					var sl2 = sl;
2218
2219					if( sl.parent().is('a') ){
2220						sl = sl.parent();
2221					}
2222
2223					// NEW FEATURE v3.5 sublayerContainer
2224
2225					var slC = 0;
2226					if( ls.o.layersContainer ){
2227						slC = ls.o.layersContainer > 0 ? ( ls.g.sliderWidth() - ls.o.layersContainer ) / 2 : 0;
2228					}else if( ls.o.sublayerContainer ){
2229						slC = ls.o.sublayerContainer > 0 ? ( ls.g.sliderWidth() - ls.o.sublayerContainer ) / 2 : 0;
2230					}
2231					slC = slC < 0 ? 0 : slC;
2232
2233					// (RE)positioning sublayer (left property)
2234
2235					if( ol.indexOf('%') != -1 ){
2236						sl.css({
2237							left : ls.g.sliderWidth() / 100 * parseInt(ol) - sl2.width() / 2 - opl - obl
2238						});
2239					}else if( slC > 0 || ls.g.responsiveMode || ls.o.responsiveUnder > 0 ){
2240						sl.css({
2241							left : slC + parseInt(ol) * ls.g.ratio
2242						});
2243					}
2244
2245					// (RE)positioning sublayer (top property)
2246
2247					if( ot.indexOf('%') != -1 ){
2248						sl.css({
2249							top : ls.g.sliderHeight() / 100 * parseInt(ot) - sl2.height() / 2 - opt - obt
2250						});
2251					}else if( ls.g.responsiveMode || ls.o.responsiveUnder > 0 ){
2252						sl.css({
2253							top : parseInt(ot) * ls.g.ratio
2254						});
2255					}
2256
2257				}else{
2258
2259					var inner = $(el).find('.ls-inner');
2260
2261					sl.css({
2262						width : 'auto',
2263						height : 'auto'
2264					});
2265
2266					ow = sl.width();
2267					oh = sl.height();
2268
2269					// IMPROVEMENT v4.5.0 Resizing smaller background images in full width mode as well to fill the whole slide
2270
2271					var or = ls.g.ratio;
2272
2273					if( ls.g.sliderOriginalWidth.indexOf('%') != -1 ){
2274						if( ls.g.sliderWidth() > ow ){
2275							or = ls.g.sliderWidth() / ow;
2276							if( ls.g.sliderHeight() > oh * or ){
2277								or = ls.g.sliderHeight() / oh;
2278							}
2279						}else if( ls.g.sliderHeight() > oh ){
2280							or = ls.g.sliderHeight() / oh;
2281							if( ls.g.sliderWidth() > ow * or ){
2282								or = ls.g.sliderWidth() / ow;
2283							}
2284						}
2285					}
2286
2287					sl.css({
2288						width : ow * or,
2289						height : oh * or,
2290						marginLeft : inner.width() / 2 - ow * or / 2,
2291						marginTop : inner.height() / 2 - oh * or / 2
2292					});
2293//					$('#w2 span:eq(0)').html( ( inner.width() / 2 ) - Math.round( ow * or / 2 ) );
2294				}
2295			});
2296
2297			layer.css({
2298				display: 'none',
2299				visibility: 'visible'
2300			});
2301
2302			// Resizing shadow
2303
2304			ls.resizeShadow();
2305
2306			callback();
2307
2308			$(this).dequeue();
2309		};
2310
2311		// Resizing shadow
2312
2313		ls.resizeShadow = function(){
2314			if( ls.g.shadowImg ){
2315				var resizeShadow = function(){
2316					if( ls.g.shadowImg.height() > 0 ){
2317						if( ls.g.shadowBtmMod > 0 ){
2318							ls.g.shadow.css({
2319								height: ls.g.shadowImg.height() / 2
2320							});
2321						}else{
2322							ls.g.shadow.css({
2323								height: ls.g.shadowImg.height(),
2324								marginTop: - ls.g.shadowImg.height() / 2
2325							});
2326						}
2327					}else{
2328						setTimeout(function(){
2329							resizeShadow();
2330						},50);
2331					}
2332				};
2333
2334				resizeShadow();
2335			}
2336		};
2337
2338		// Resizing the slider
2339
2340		ls.resizeSlider = function(){
2341
2342			if( ls.o.responsiveUnder > 0 ){
2343
2344				if( $(window).width() < ls.o.responsiveUnder ){
2345					ls.g.responsiveMode = true;
2346					ls.g.sliderOriginalWidth = ls.o.responsiveUnder + 'px';
2347				}else{
2348					ls.g.responsiveMode = false;
2349					ls.g.sliderOriginalWidth = ls.g.sliderOriginalWidthRU;
2350					ls.g.ratio = 1;
2351				}
2352			}
2353
2354			// NEW FEATURE v3.0 added "normal" responsive mode with image and font resizing
2355
2356			if( ls.g.responsiveMode ){
2357
2358				var parent = $(el).parent();
2359
2360				// BUGFIX v4.0 there is no need to subtract the values of the left and right paddings of the container element!
2361
2362				$(el).css({
2363					width : parent.width() - parseInt($(el).css('padding-left')) - parseInt($(el).css('padding-right'))
2364				});
2365				ls.g.ratio = $(el).width() / parseInt( ls.g.sliderOriginalWidth );
2366				$(el).css({
2367					height : ls.g.ratio * parseInt( ls.g.sliderOriginalHeight )
2368				});
2369
2370			}else{
2371				ls.g.ratio = 1;
2372				$(el).css({
2373					width : ls.g.sliderOriginalWidth,
2374					height : ls.g.sliderOriginalHeight
2375				});
2376			}
2377
2378			// WP fullWidth mode (originally forceResponsive mode)
2379
2380			if( $(el).closest('.ls-wp-fullwidth-container').length ){
2381
2382				$(el).closest('.ls-wp-fullwidth-helper').css({
2383					height : $(el).outerHeight(true)
2384				});
2385
2386				$(el).closest('.ls-wp-fullwidth-container').css({
2387					height : $(el).outerHeight(true)
2388				});
2389
2390				$(el).closest('.ls-wp-fullwidth-helper').css({
2391					width : $(window).width(),
2392					left : - $(el).closest('.ls-wp-fullwidth-container').offset().left
2393				});
2394
2395				if( ls.g.sliderOriginalWidth.indexOf('%') != -1 ){
2396
2397					var percentWidth = parseInt( ls.g.sliderOriginalWidth );
2398					var newWidth = $('body').width() / 100 * percentWidth - ( $(el).outerWidth() - $(el).width() );
2399					$(el).width( newWidth );
2400				}
2401			}
2402
2403			$(el).find('.ls-inner, .ls-lt-container').css({
2404				width : ls.g.sliderWidth(),
2405				height : ls.g.sliderHeight()
2406			});
2407
2408			// BUGFIX v2.0 fixed width problem if firstSlide is not 1
2409
2410			if( ls.g.curLayer && ls.g.nextLayer ){
2411
2412				ls.g.curLayer.css({
2413					width : ls.g.sliderWidth(),
2414					height : ls.g.sliderHeight()
2415				});
2416
2417				ls.g.nextLayer.css({
2418					width : ls.g.sliderWidth(),
2419					height : ls.g.sliderHeight()
2420				});
2421
2422			}else{
2423
2424				$(el).find('.ls-slide').css({
2425					width : ls.g.sliderWidth(),
2426					height : ls.g.sliderHeight()
2427				});
2428			}
2429		};
2430
2431		// NEW FEATURE v3.0 added responsive yourLogo
2432
2433		ls.resizeYourLogo = function(){
2434
2435			ls.g.yourLogo.css({
2436				width : ls.g.yourLogo.data( 'originalWidth' ) * ls.g.ratio,
2437				height : ls.g.yourLogo.data( 'originalHeight' ) * ls.g.ratio
2438			});
2439
2440			if( ls.g.ie78 ){
2441				ls.g.yourLogo.css('display','block');
2442			}else{
2443				ls.g.yourLogo.fadeIn(300);
2444			}
2445
2446			var oL = oR = oT = oB = 'auto';
2447
2448			if( ls.g.yourLogo.data( 'originalLeft' ) && ls.g.yourLogo.data( 'originalLeft' ).indexOf('%') != -1 ){
2449				oL = ls.g.sliderWidth() / 100 * parseInt( ls.g.yourLogo.data( 'originalLeft' ) ) - ls.g.yourLogo.width() / 2 + parseInt( $(el).css('padding-left') );
2450			}else{
2451				oL = parseInt( ls.g.yourLogo.data( 'originalLeft' ) ) * ls.g.ratio;
2452			}
2453
2454			if( ls.g.yourLogo.data( 'originalRight' ) && ls.g.yourLogo.data( 'originalRight' ).indexOf('%') != -1 ){
2455				oR = ls.g.sliderWidth() / 100 * parseInt( ls.g.yourLogo.data( 'originalRight' ) ) - ls.g.yourLogo.width() / 2 + parseInt( $(el).css('padding-right') );
2456			}else{
2457				oR = parseInt( ls.g.yourLogo.data( 'originalRight' ) ) * ls.g.ratio;
2458			}
2459
2460			if( ls.g.yourLogo.data( 'originalTop' ) && ls.g.yourLogo.data( 'originalTop' ).indexOf('%') != -1 ){
2461				oT = ls.g.sliderHeight() / 100 * parseInt( ls.g.yourLogo.data( 'originalTop' ) ) - ls.g.yourLogo.height() / 2 + parseInt( $(el).css('padding-top') );
2462			}else{
2463				oT = parseInt( ls.g.yourLogo.data( 'originalTop' ) ) * ls.g.ratio;
2464			}
2465
2466			if( ls.g.yourLogo.data( 'originalBottom' ) && ls.g.yourLogo.data( 'originalBottom' ).indexOf('%') != -1 ){
2467				oB = ls.g.sliderHeight() / 100 * parseInt( ls.g.yourLogo.data( 'originalBottom' ) ) - ls.g.yourLogo.height() / 2 + parseInt( $(el).css('padding-bottom') );
2468			}else{
2469				oB = parseInt( ls.g.yourLogo.data( 'originalBottom' ) ) * ls.g.ratio;
2470			}
2471
2472			ls.g.yourLogo.css({
2473				left : oL,
2474				right : oR,
2475				top : oT,
2476				bottom : oB
2477			});
2478		};
2479
2480		// NEW FEATURE v3.5 thumbnailNavigation ('always')
2481
2482		// Resizing thumbnails
2483
2484		ls.resizeThumb = function(){
2485
2486			ls.bottomNavSizeHelper('on');
2487
2488			var sliderW = ls.g.sliderOriginalWidth.indexOf('%') == -1 ? parseInt( ls.g.sliderOriginalWidth ) 
2488: ls.g.sliderWidth();
2489
2490			$(el).find('.ls-thumbnail-slide a').css({
2491				width : parseInt( ls.o.tnWidth * ls.g.ratio ),
2492				height : parseInt( ls.o.tnHeight * ls.g.ratio )
2493			});
2494
2495			$(el).find('.ls-thumbnail-slide a:last').css({
2496				margin: 0
2497			});
2498
2499			$(el).find('.ls-thumbnail-slide').css({
2500				height : parseInt( ls.o.tnHeight * ls.g.ratio )
2501			});
2502
2503			var tn = $(el).find('.ls-thumbnail');
2504
2505			var originalWidth = ls.o.tnContainerWidth.indexOf('%') == -1 ? parseInt( ls.o.tnContainerWidth ) : parseInt( sliderW / 100 * parseInt( ls.o.tnContainerWidth ) );
2506
2507			tn.css({
2508				width : originalWidth * Math.floor( ls.g.ratio * 100 ) / 100
2509			});
2510
2511			if( tn.width() > $(el).find('.ls-thumbnail-slide').width() ){
2512				tn.css({
2513					width : $(el).find('.ls-thumbnail-slide').width()
2514				});
2515			}
2516
2517			ls.bottomNavSizeHelper('off');
2518		};
2519
2520		// Changing thumbnails
2521
2522		ls.changeThumb = function(index){
2523
2524			var curIndex = index ? index : ls.g.nextLayerIndex;
2525
2526			$(el).find('.ls-thumbnail-slide a:not(.ls-thumb-'+curIndex+')').children().each(function(){
2527				$(this).removeClass('ls-thumb-active').stop().fadeTo(750,ls.o.tnInactiveOpacity/100);
2528			});
2529
2530			$(el).find('.ls-thumbnail-slide a.ls-thumb-'+curIndex).children().addClass('ls-thumb-active').stop().fadeTo(750,ls.o.tnActiveOpacity/100);
2531		};
2532
2533		// Scrolling thumbnails
2534
2535		ls.scrollThumb = function(){
2536
2537			if( !$(el).find('.ls-thumbnail-slide-container').hasClass('ls-thumbnail-slide-hover') ){
2538				var curThumb = $(el).find('.ls-thumb-active').length ? $(el).find('.ls-thumb-active').parent() : false;
2539				if( curThumb ){
2540					var thumbCenter = curThumb.position().left + curThumb.width() / 2;
2541					var mL = $(el).find('.ls-thumbnail-slide-container').width() / 2 - thumbCenter;
2542					mL = mL < $(el).find('.ls-thumbnail-slide-container').width() - $(el).find('.ls-thumbnail-slide').width() ? $(el).find('.ls-thumbnail-slide-container').width() - $(el).find('.ls-thumbnail-slide').width() : mL;
2543					mL = mL > 0 ? 0 : mL;
2544					$(el).find('.ls-thumbnail-slide').animate({
2545						marginLeft : mL
2546					}, 600 );
2547				}
2548			}
2549		};
2550
2551		// IMPROVEMENT v4.1.3 Changed the working of some Thumbnail and Bottom Navigation features
2552
2553		ls.bottomNavSizeHelper = function(val){
2554
2555			if( ls.o.hoverBottomNav && !$(el).hasClass('ls-hover') ){
2556				switch(val){
2557					case 'on':
2558						ls.g.thumbsWrapper.css({
2559							visibility: 'hidden',
2560							display: 'block'
2561						});
2562					break;
2563					case 'off':
2564						ls.g.thumbsWrapper.css({
2565							visibility: 'visible',
2566							display: 'none'
2567						});
2568					break;
2569				}
2570			}
2571		};
2572
2573		// Animating layers and sublayers
2574
2575		ls.animate = function(){
2576
2577			/* GLOBAL (used by both old and new transitions ) */
2578
2579					// Changing variables
2580					// BUGFIX v4.6.0 If there is only one layer, there is no need to set ls.g.isAnimating to true
2581
2582					if( $(el).find('.ls-slide').length > 1 ){
2583						ls.g.isAnimating = true;
2584					}
2585
2586					ls.g.isLoading = false;
2587
2588					// Clearing timeouts
2589
2590					clearTimeout( ls.g.slideTimer );
2591					clearTimeout( ls.g.changeTimer );
2592
2593					ls.g.stopLayer = ls.g.curLayer;
2594
2595					// Calling cbAnimStart callback function
2596
2597					ls.o.cbAnimStart(ls.g);
2598
2599					// NEW FEATURE v3.5 thumbnailNavigation ('always')
2600
2601					if( ls.o.thumbnailNavigation == 'always' ){
2602
2603						// ChangeThumb
2604
2605						ls.changeThumb();
2606
2607						// ScrollThumb
2608
2609						if( !('ontouchstart' in window) ){
2610							ls.scrollThumb();
2611						}
2612					}
2613
2614					// Adding .ls-animating class to next layer
2615
2616					ls.g.nextLayer.addClass('ls-animating');
2617
2618
2619
2620			/* OLD layer transitions (version 3.x) */
2621
2622					// Setting position and styling of current and next layers
2623
2624					var curLayerLeft = curLayerRight = curLayerTop = curLayerBottom = nextLayerLeft = nextLayerRight = nextLayerTop = nextLayerBottom = layerMarginLeft = layerMarginRight = layerMarginTop = layerMarginBottom = 'auto';
2625					var curLayerWidth = nextLayerWidth = ls.g.sliderWidth();
2626					var curLayerHeight = nextLayerHeight = ls.g.sliderHeight();
2627
2628					// Calculating direction
2629
2630					var prevOrNext = ls.g.prevNext == 'prev' ? ls.g.curLayer : ls.g.nextLayer;
2631					var chooseDirection = prevOrNext.data('slidedirection') ? prevOrNext.data('slidedirection') : ls.o.slideDirection;
2632
2633					// Setting the direction of sliding
2634
2635					var slideDirection = ls.g.slideDirections[ls.g.prevNext][chooseDirection];
2636
2637					if( slideDirection == 'left' || slideDirection == 'right' ){
2638						curLayerWidth = curLayerTop = nextLayerWidth = nextLayerTop = 0;
2639						layerMarginTop = 0;
2640					}
2641					if( slideDirection == 'top' || slideDirection == 'bottom' ){
2642						curLayerHeight = curLayerLeft = nextLayerHeight = nextLayerLeft = 0;
2643						layerMarginLeft = 0;
2644					}
2645
2646					switch(slideDirection){
2647						case 'left':
2648							curLayerRight = nextLayerLeft = 0;
2649							layerMarginLeft = -ls.g.sliderWidth();
2650							break;
2651						case 'right':
2652							curLayerLeft = nextLayerRight = 0;
2653							layerMarginLeft = ls.g.sliderWidth();
2654							break;
2655						case 'top':
2656							curLayerBottom = nextLayerTop = 0;
2657							layerMarginTop = -ls.g.sliderHeight();
2658							break;
2659						case 'bottom':
2660							curLayerTop = nextLayerBottom = 0;
2661							layerMarginTop = ls.g.sliderHeight();
2662							break;
2663					}
2664
2665					// Setting start positions and styles of layers
2666
2667					ls.g.curLayer.css({
2668						left : curLayerLeft,
2669						right : curLayerRight,
2670						top : curLayerTop,
2671						bottom : curLayerBottom
2672					});
2673					ls.g.nextLayer.css({
2674						width : nextLayerWidth,
2675						height : nextLayerHeight,
2676						left : nextLayerLeft,
2677						right : nextLayerRight,
2678						top : nextLayerTop,
2679						bottom : nextLayerBottom
2680					});
2681
2682					// Creating variables for the OLD transitions of CURRENT LAYER
2683
2684					// BUGFIX v1.6 fixed some wrong parameters of current layer
2685					// BUGFIX v1.7 fixed using of delayout of current layer
2686
2687					var curDelay = ls.g.curLayer.data('delayout') ? parseInt(ls.g.curLayer.data('delayout')) : ls.o.delayOut;
2688
2689					var curDuration = ls.g.curLayer.data('durationout') ? parseInt(ls.g.curLayer.data('durationout')) : ls.o.durationOut;
2690					var curEasing = ls.g.curLayer.data('easingout') ? ls.g.curLayer.data('easingout') : ls.o.easingOut;
2691
2692					// Creating variables for the OLD transitions of NEXT LAYER
2693
2694					var nextDelay = ls.g.nextLayer.data('delayin') ? parseInt(ls.g.nextLayer.data('delayin')) : ls.o.delayIn;
2695					var nextDuration = ls.g.nextLayer.data('durationin') ? parseInt(ls.g.nextLayer.data('durationin')) : ls.o.durationIn;
2696					var nextEasing = ls.g.nextLayer.data('easingin') ? ls.g.nextLayer.data('easingin') : ls.o.easingIn;
2697
2698					var curLayer = function(){
2699
2700						// BUGFIX v1.6 added an additional delaytime to current layer to fix the '1px ga
2700p' bug
2701						// BUGFIX v3.0 modified from curDuration / 80 to curDuration / 15
2702
2703						ls.g.curLayer.delay( curDelay + curDuration / 15).animate({
2704							width : curLayerWidth,
2705							height : curLayerHeight
2706						}, curDuration, curEasing,function(){
2707
2708							curLayerCallback();
2709						});
2710					};
2711
2712					var curLayerCallback = function(){
2713
2714						// Stopping current sublayer animations if needed (they are not visible at this point).
2715
2716						ls.g.stopLayer.find(' > *[class*="ls-l"]').each(function(){
2717							if( $(this).data('tr') ){
2718								$(this).data('tr').kill();
2719							}
2720
2721							$(this).css({
2722								filter: 'none'
2723							});
2724						});
2725
2726						// FIXED v4.0 Calling cbAnimStop callback function before changing layer indexes
2727
2728						ls.o.cbAnimStop(ls.g);
2729
2730						// Setting current layer
2731
2732						ls.g.curLayer = ls.g.nextLayer;
2733						ls.g.curLayerIndex = ls.g.nextLayerIndex;
2734
2735						// NEW FEATURE v5.0.0 Lazy-load (preloading here the images of the next layer)
2736
2737						if( ls.o.imgPreload && ls.o.lazyLoad ){
2738
2739							var preLayerIndex = ls.g.curLayerIndex == ls.g.layersNum ? 1 : ls.g.curLayerIndex + 1;
2740							$(el).find('.ls-slide').eq(preLayerIndex-1).find('img:not(.ls-preloaded)').each(function(){
2741								$(this).load(function(){
2742									$(this).addClass('ls-preloaded');
2743								}).error(function(){
2744									var imgURL = $(this).data('src').substring($(this).data('src').lastIndexOf("/") + 1, $(this).data('src').length);
2745									if( window.console ){
2746										console('LayerSlider error:\r\n\r\nIt seems like the URL of the image or background image "'+imgURL+'" is pointing to a wrong location and it cannot be loaded. Please check the URLs of all your images used in the slider.');
2747									}else{
2748										alert('LayerSlider error:\r\n\r\nIt seems like the URL of the image or background image "'+imgURL+'" is pointing to a wrong location and it cannot be loaded. Please check the URLs of all your images used in the slider.');
2749									}
2750									$(this).addClass('ls-not-preloaded');
2751								}).attr('src', $(this).data('src'));
2752							});
2753						}
2754
2755						// Changing some css classes
2756
2757						$(el).find('.ls-slide').removeClass('ls-active');
2758						$(el).find('.ls-slide:eq(' + ( ls.g.curLayerIndex - 1 ) + ')').addClass('ls-active').removeClass('ls-animating');
2759						$(el).find('.ls-bottom-slidebuttons a').removeClass('ls-nav-active');
2760						$(el).find('.ls-bottom-slidebuttons a:eq('+( ls.g.curLayerIndex - 1 )+')').addClass('ls-nav-active');
2761
2762						// Setting timer if needed
2763
2764						if( ls.g.autoSlideshow ){
2765							ls.timer();
2766						}
2767
2768						// Changing variables
2769
2770						ls.g.isAnimating = false;
2771						if( ls.g.resize == true ){
2772							ls.makeResponsive( ls.g.curLayer, function(){
2773								ls.g.resize = false;
2774							});
2775						}
2776					};
2777
2778					var curSubLayers = function(sublayersDurationOut){
2779
2780						ls.g.curLayer.find(' > *[class*="ls-l"]').each(function(){
2781
2782							if( !$(this).data('transitiontype') ){
2783								ls.transitionType( $(this) );
2784							}
2785
2786							// BUGFIX v5.1.0 Removing ls-videohack class before starting transition
2787
2788							$(this).removeClass('ls-videohack');
2789
2790							var curSubSlideDir = $(this).data('slidedirection') ? $(this).data('slidedirection') : slideDirection;
2791							var lml, lmt;
2792
2793							switch(curSubSlideDir){
2794								case 'left':
2795									lml = -ls.g.sliderWidth();
2796									lmt = 0;
2797									break;
2798								case 'right':
2799									lml = ls.g.sliderWidth();
2800									lmt = 0;
2801									break;
2802								case 'top':
2803									lmt = -ls.g.sliderHeight();
2804									lml = 0;
2805									break;
2806								case 'bottom':
2807									lmt = ls.g.sliderHeight();
2808									lml = 0;
2809									break;
2810								case 'fade':
2811									lmt = 0;
2812									lml = 0;
2813									break;
2814							}
2815
2816							// NEW FEATURE v1.6 added slideoutdirection to sublayers
2817							// NEW FEATURES 5.0.0 added axis-free transitions with offsetx and offsety properties
2818
2819							if( $(this).data('transitiontype') === 'new' ){
2820								var curSubSlideOutDir = 'new';
2821							}else{
2822								var curSubSlideOutDir = $(this).data('slideoutdirection') ? $(this).data('slideoutdirection') : false;
2823							}
2824
2825							switch(curSubSlideOutDir){
2826								case 'left':
2827									lml = ls.g.sliderWidth();
2828									lmt = 0;
2829									break;
2830								case 'right':
2831									lml = -ls.g.sliderWidth();
2832									lmt = 0;
2833									break;
2834								case 'top':
2835									lmt = ls.g.sliderHeight();
2836									lml = 0;
2837									break;
2838								case 'bottom':
2839									lmt = -ls.g.sliderHeight();
2840									lml = 0;
2841									break;
2842								case 'fade':
2843									lmt = 0;
2844									lml = 0;
2845									break;
2846								case 'new':
2847									if( $(this).data('offsetxout') ){
2848										if( $(this).data('offsetxout') === 'left' ){
2849											lml = ls.g.sliderWidth();
2850										}else if( $(this).data('offsetxout') === 'right' ){
2851											lml = -ls.g.sliderWidth();
2852										}else{
2853											lml = -parseInt( $(this).data('offsetxout') );
2854										}
2855									}else{
2856										lml = -ls.lt.offsetXOut;
2857									}
2858									if( $(this).data('offsetyout') ){
2859										if( $(this).data('offsetyout') === 'top' ){
2860											lmt = ls.g.sliderHeight();
2861										}else if( $(this).data('offsetyout') === 'bottom' ){
2862											lmt = -ls.g.sliderHeight();
2863										}else{
2864											lmt = -parseInt( $(this).data('offsetyout') );
2865										}
2866									}else{
2867										lmt = -ls.lt.offsetYOut;
2868									}
2869									break;
2870							}
2871
2872							// NEW FEATURES v4.5.0 Rotating & Scaling sublayers
2873							// BUGFIX v4.5.5 changing the default value from 0 to 'none' (because of old jQuery, 1.7.2)
2874							// NEW FEATURES v5.0.0 Added SkewX, SkewY, ScaleX, ScaleY, RotateX & RotateY transitions
2875
2876							var curSubRotate = curSubRotateX = curSubRotateY = curSubScale = curSubSkewX = curSubSkewY = curSubScaleX = curSubScaleY = 'none';
2877//							if( !ls.g.ie78 && ls.g.enableCSS3 ){
2878								curSubRotate = $(this).data('rotateout') ? $(this).data('rotateout') : ls.lt.rotateOut;
2879								curSubRotateX = $(this).data('rotatexout') ? $(this).data('rotatexout') : ls.lt.rotateXOut;
2880								curSubRotateY = $(this).data('rotateyout') ? $(this).data('rotateyout') : ls.lt.rotateYOut;
2881								curSubScale = $(this).data('scaleout') ? $(this).data('scaleout') : ls.lt.scaleOut;
2882								curSubSkewX = $(this).data('skewxout') ? $(this).data('skewxout') : ls.lt.skewXOut;
2883								curSubSkewY = $(this).data('skewyout') ? $(this).data('skewyout') : ls.lt.skewYOut;
2884								if( curSubScale === 1 ){
2885									curSubScaleX = $(this).data('scalexout') ? $(this).data('scalexout') : ls.lt.scaleXOut;
2886									curSubScaleY = $(this).data('scaleyout') ? $(this).data('scaleyout') : ls.lt.scaleYOut;
2887								}else{
2888									curSubScaleX = curSubScaleY = curSubScale;
2889								}
2890								var too = $(this).data('transformoriginout') ? $(this).data('transformoriginout').split(' ') : ls.lt.transformOriginOut;
2891								for(var t =0;t<too.length;t++){
2892									if( too[t].indexOf('%') === -1 && too[t].indexOf('left') !== -1 && too[t].indexOf('right') !== -1 && too[t].indexOf('top') !== -1 && too[t].indexOf('bottom') !== -1 ){
2893										too[t] = '' + parseInt( too[t] ) * ls.g.ratio + 'px';
2894									}
2895								}
2896								var curSubTransformOrigin = too.join(' ');
2897								var curSubPerspective = $(this).data('perspectiveout') ? $(this).data('perspectiveout') : ls.lt.perspectiveOut;
2898//							}
2899
2900							// IMPROVEMENT v4.0 Distance (P.level): -1
2901
2902							var endLeft = parseInt( $(this).css('left') );
2903							var endTop = parseInt( $(this).css('top') );
2904
2905							var curSubPLevel = parseInt( $(this).attr('class').split('ls-l')[1] );
2906
2907							var wh = $(this).outerWidth() > $(this).outerHeight() ? $(this).outerWidth() : $(this).outerHeight();
2908							var modX = parseInt( curSubRotate ) === 0 ? $(this).outerWidth() : wh;
2909							var modY = parseInt( curSubRotate ) === 0 ? $(this).outerHeight() : wh;
2910
2911							if( ( curSubPLevel === -1 && curSubSlideOutDir !== 'new' ) || ( $(this).data('offsetxout') === 'left' || $(this).data('offsetxout') === 'right' ) ){
2912								if( lml < 0 ){
2913									lml = - ( ls.g.sliderWidth() - endLeft + ( curSubScaleX / 2 - .5 ) * modX + 100  );
2914								}else if( lml > 0 ){
2915									lml = endLeft + ( curSubScaleX / 2 + .5 ) * modX + 100;
2916								}
2917							}else{
2918								lml = lml * ls.g.ratio;
2919							}
2920
2921							if( ( curSubPLevel === -1 && curSubSlideOutDir !== 'new' ) || ( $(this).data('offsetyout') === 'top' || $(this).data('offsetyout') === 'bottom' ) ){
2922								if( lmt < 0 ){
2923									lmt = - ( ls.g.sliderHeight() - endTop + ( curSubScaleY / 2 - .5 ) * modY + 100  );
2924								}else if( lmt > 0 ){
2925									lmt = endTop + ( curSubScaleY / 2 + .5 ) * modY + 100;
2926								}
2927							}else{
2928								lmt = lmt * ls.g.ratio;
2929							}
2930
2931							if( curSubPLevel === -1 || curSubSlideOutDir === 'new' ){
2932								var curSubPar = 1;
2933							}else{
2934								var curSubParMod = ls.g.curLayer.data('parallaxout') ? parseInt(ls.g.curLayer.data('parallaxout')) : ls.o.parallaxOut;
2935								var curSubPar = curSubPLevel * curSubParMod;
2936							}
2937
2938							if( $(this).data('transitiontype') === 'new' ){
2939								var deO = ls.lt.delayOut;
2940								var duO = ls.lt.durationOut;
2941								var eO = ls.lt.easingOut;
2942							}else{
2943								var deO = ls.o.delayOut;
2944								var duO = ls.o.durationOut;
2945								var eO = ls.o.easingOut;
2946							}
2947
2948							var curSubDelay = $(this).data('delayout') ? parseInt($(this).data('delayout')) : deO;
2949							var curSubTime = $(this).data('durationout') ? parseInt($(this).data('durationout')) : duO;
2950							var curSubEasing = $(this).data('easingout') ? $(this).data('easingout') : eO;
2951
2952							// On new layer transitions, all sublayer will be slide / fade out in 500ms without any delays
2953
2954							if(sublayersDurationOut){
2955								curSubDelay = 0;
2956								curSubTime = sublayersDurationOut;
2957								// curSubEasing = 'easeInExpo';
2958							}
2959
2960							// Clearing showUntilTimers
2961
2962							if( $(this).data('showUntilTimer') ){
2963								clearTimeout( $(this).data('showUntilTimer') );
2964							}
2965
2966							var css = {
2967								visibility : 'hidden'
2968							};
2969
2970							var el = $(this);
2971
2972							var transition = {
2973								rotation : curSubRotate,
2974								rotationX : curSubRotateX,
2975								rotationY : curSubRotateY,
2976								skewX : curSubSkewX,
2977								skewY : curSubSkewY,
2978								scaleX : curSubScaleX,
2979								scaleY : curSubScaleY,
2980								x : -lml * curSubPar,
2981								y : -lmt * curSubPar,
2982								delay : curSubDelay/1000,
2983								ease : lsConvertEasing( curSubEasing ),
2984								onComplete : function(){
2985									el.css( css );
2986								}
2987							};
2988
2989							if( curSubSlideOutDir == 'fade' || ( !curSubSlideOutDir && curSubSlideDir === 'fade' ) || ( $(this).data('fadeout') !== 'false' && $(this).data('transitiontype') === 'new' ) ){
2990								transition['opacity'] = 0;
2991								css['opacity'] = $(this).data( 'originalOpacity' );
2992							}
2993
2994							if( $(this).data('tr') ){
2995								$(this).data('tr').kill();
2996							}
2997
2998							TweenLite.set( $(this)[0],{
2999								transformOrigin : curSubTransformOrigin,
3000								transformPerspective : curSubPerspective
3001							});
3002
3003							$(this).data('tr', TweenLite.to($(this)[0],curSubTime/1000,transition) );
3004
3005							// $(this).stop(true,false).delay( curSubDelay ).animate( transition, curSubTime, curSubEasing,function(){
3006							// 	$(this).css( css );
3007							// });
3008						});
3009					};
3010
3011					var nextLayer = function(){
3012
3013						ls.g.nextLayer.delay( curDelay + nextDelay ).animate({
3014							width : ls.g.sliderWidth(),
3015							height : ls.g.sliderHeight()
3016						}, nextDuration, nextEasing );
3017					};
3018
3019					var nextSubLayers = function(){
3020
3021						if( ls.g.totalDuration ){
3022							curDelay = 0;
3023						}
3024
3025						// Needed for the Timeline
3026						if( typeof ls.o.cbTimeLineStart === 'function' ){
3027							ls.o.cbTimeLineStart(ls.g, curDelay+nextDelay );
3028						}
3029
3030						ls.g.nextLayer.find(' > *[class*="ls-l"]').each(function(){
3031
3032							// Replacing global parameters with unique if need
3033							// NEW FEATURES 5.0.0 added axis-free transitions with offsetx and offsety properties
3034
3035							if( !$(this).data('transitiontype') ){
3036								ls.transitionType( $(this) );
3037							}
3038
3039							if( $(this).data('transitiontype') === 'new' ){
3040								var nextSubSlideDir = 'new';
3041							}else{
3042								var nextSubSlideDir = $(this).data('slidedirection') ? $(this).data('slidedirection') : slideDirection;
3043							}
3044							var lml, lmt;
3045
3046							switch(nextSubSlideDir){
3047								case 'left':
3048									lml = -ls.g.sliderWidth();
3049									lmt = 0;
3050									break;
3051								case 'right':
3052									lml = ls.g.sliderWidth();
3053									lmt = 0;
3054									break;
3055								case 'top':
3056									lmt = -ls.g.sliderHeight();
3057									lml = 0;
3058									break;
3059								case 'bottom':
3060									lmt = ls.g.sliderHeight();
3061									lml = 0;
3062									break;
3063								case 'fade':
3064									lmt = 0;
3065									lml = 0;
3066									break;
3067								case 'new':
3068									if( $(this).data('offsetxin') ){
3069										if( $(this).data('offsetxin') === 'left' ){
3070											lml = -ls.g.sliderWidth();
3071										}else if( $(this).data('offsetxin') === 'right' ){
3072											lml = ls.g.sliderWidth();
3073										}else{
3074											lml = parseInt( $(this).data('offsetxin') );
3075										}
3076									}else{
3077										lml = ls.lt.offsetXIn;
3078									}
3079									if( $(this).data('offsetyin') ){
3080										if( $(this).data('offsetyin') === 'top' ){
3081											lmt = -ls.g.sliderHeight();
3082										}else if( $(this).data('offsetyin') === 'bottom' ){
3083											lmt = ls.g.sliderHeight();
3084										}else{
3085											lmt = parseInt( $(this).data('offsetyin') );
3086										}
3087									}else{
3088										lmt = ls.lt.offsetYIn;
3089									}
3090									break;
3091							}
3092
3093							// NEW FEATURE v4.5.0 Rotating & Scaling sublayers
3094							// BUGFIX v4.5.5 changing the default value from 0 to 'none' (because of old jQuery, 1.7.2)
3095							// NEW FEATURES v5.0.0 Added SkewX, SkewY, ScaleX, ScaleY, RotateX & RotateY transitions
3096
3097							var nextSubRotate = nextSubRotateX = nextSubRotateY = nextSubScale = nextSubSkewX 
3097= nextSubSkewY = nextSubScaleX = nextSubScaleY = 'none';
3098//							if( !ls.g.ie78 && ls.g.enableCSS3 ){
3099								nextSubRotate = $(this).data('rotatein') ? $(this).data('rotatein') : ls.lt.rotateIn;
3100								nextSubRotateX = $(this).data('rotatexin') ? $(this).data('rotatexin') : ls.lt.rotateXIn;
3101								nextSubRotateY = $(this).data('rotateyin') ? $(this).data('rotateyin') : ls.lt.rotateYIn;
3102								nextSubScale = $(this).data('scalein') ? $(this).data('scalein') : ls.lt.scaleIn;
3103								nextSubSkewX = $(this).data('skewxin') ? $(this).data('skewxin') : ls.lt.skewXIn;
3104								nextSubSkewY = $(this).data('skewyin') ? $(this).data('skewyin') : ls.lt.skewYIn;
3105								if( nextSubScale === 1 ){
3106									nextSubScaleX = $(this).data('scalexin') ? $(this).data('scalexin') : ls.lt.scaleXIn;
3107									nextSubScaleY = $(this).data('scaleyin') ? $(this).data('scaleyin') : ls.lt.scaleYIn;
3108								}else{
3109									nextSubScaleX = nextSubScaleY = nextSubScale;
3110								}
3111
3112								var toi = $(this).data('transformoriginin') ? $(this).data('transformoriginin').split(' ') : ls.lt.transformOriginIn;
3113								for(var t =0;t<toi.length;t++){
3114									if( toi[t].indexOf('%') === -1 && toi[t].indexOf('left') !== -1 && toi[t].indexOf('right') !== -1 && toi[t].indexOf('top') !== -1 && toi[t].indexOf('bottom') !== -1 ){
3115										toi[t] = '' + parseInt( toi[t] ) * ls.g.ratio + 'px';
3116									}
3117								}
3118								var nextSubTransformOrigin = toi.join(' ');
3119								var nextSubPerspective = $(this).data('perspectivein') ? $(this).data('perspectivein') : ls.lt.perspectiveIn;
3120//							}
3121
3122							// IMPROVEMENT v4.0 Distance (P.level): -1
3123
3124							var endLeft = parseInt( $(this).css('left') );
3125							var endTop = parseInt( $(this).css('top') );
3126
3127							var nextSubPLevel = parseInt( $(this).attr('class').split('ls-l')[1] );
3128
3129							// BUGFIX v5.0.1 Fixed the starting position of layers with percentage value of width
3130
3131							if( $(this)[0].style.width.indexOf('%') !== -1 ){
3132								$(this).css({
3133									width: ls.g.sliderWidth() / 100 * parseInt( $(this)[0].style.width )
3134								});
3135							}
3136
3137							var wh = $(this).outerWidth() > $(this).outerHeight() ? $(this).outerWidth() : $(this).outerHeight();
3138							var modX = parseInt( nextSubRotate ) === 0 ? $(this).outerWidth() : wh;
3139							var modY = parseInt( nextSubRotate ) === 0 ? $(this).outerHeight() : wh;
3140
3141							// console.log( modX, $(this).outerWidth(), $(this).width(), $(this).height(), $(this)[0].style.width, $(this).outerHeight(), wh );
3142
3143							if( ( nextSubPLevel === -1 && nextSubSlideDir !== 'new' ) || ( $(this).data('offsetxin') === 'left' || $(this).data('offsetxin') === 'right' ) ){
3144								if( lml < 0 ){
3145									lml = - ( endLeft + ( nextSubScaleX / 2 + .5 ) * modX + 100  );
3146								}else if( lml > 0 ){
3147									lml = ls.g.sliderWidth() - endLeft + ( nextSubScaleX / 2 - .5 ) * modX + 100;
3148								}
3149							}else{
3150								lml = lml * ls.g.ratio;
3151							}
3152
3153							if( ( nextSubPLevel === -1 && nextSubSlideDir !== 'new' ) || ( $(this).data('offsetyin') === 'top' || $(this).data('offsetyin') === 'bottom' ) ){
3154
3155								if( lmt < 0 ){
3156									lmt = - ( endTop + ( nextSubScaleY / 2 + .5 ) * modY + 100  );
3157								}else if( lmt > 0 ){
3158									lmt = ls.g.sliderHeight() - endTop + ( nextSubScaleY / 2 - .5 ) * modY + 100;
3159								}
3160							}else{
3161								lmt = lmt * ls.g.ratio;
3162							}
3163
3164							if( nextSubPLevel === -1 || nextSubSlideDir === 'new'){
3165								var nextSubPar = 1;
3166							}else{
3167								var nextSubParMod = ls.g.nextLayer.data('parallaxin') ? parseInt(ls.g.nextLayer.data('parallaxin')) : ls.o.parallaxIn;
3168								var nextSubPar = nextSubPLevel * nextSubParMod;
3169							}
3170
3171							if( $(this).data('transitiontype') === 'new' ){
3172								var deI = ls.lt.delayIn;
3173								var duI = ls.lt.durationIn;
3174								var eI = ls.lt.easingIn;
3175							}else{
3176								var deI = ls.o.delayIn;
3177								var duI = ls.o.durationIn;
3178								var eI = ls.o.easingIn;
3179							}
3180
3181							var nextSubDelay = $(this).data('delayin') ? parseInt($(this).data('delayin')) : deI;
3182							var nextSubTime = $(this).data('durationin') ? parseInt($(this).data('durationin')) : duI;
3183							var nextSubEasing = $(this).data('easingin') ? $(this).data('easingin') : eI;
3184
3185							var cursub = $(this);
3186
3187							var nextSubCallback = function(){
3188
3189								// BUGFIX v5.1.0 Removing transition property from video layers
3190
3191								if( cursub.hasClass('ls-video-layer') ){
3192									cursub.addClass('ls-videohack');
3193								}
3194
3195								// NEW FEATURE v2.0 autoPlayVideos
3196
3197								if( ls.o.autoPlayVideos == true ){
3198
3199									cursub.find('.ls-videopreview, video, audio').click();
3200								}
3201
3202								// NEW FEATURE v3.0 showUntil sublayers
3203
3204								if( cursub.data('showuntil') > 0 ){
3205
3206									// IMPROVEMENT v4.5.0 sublayerShowUntil will be called anly if necessary
3207
3208									cursub.data('showUntilTimer', setTimeout(function(){
3209										ls.sublayerShowUntil( cursub );
3210									}, cursub.data('showuntil') ));
3211								}
3212							};
3213
3214							$(this).css({
3215								marginLeft : 0,
3216								marginTop : 0
3217							});
3218
3219							var css = {
3220								scaleX : nextSubScaleX,
3221								scaleY : nextSubScaleY,
3222								skewX : nextSubSkewX,
3223								skewY : nextSubSkewY,
3224								rotation : nextSubRotate,
3225								rotationX : nextSubRotateX,
3226								rotationY : nextSubRotateY,
3227								visibility : 'visible',
3228								x : lml * nextSubPar,
3229								y : lmt * nextSubPar
3230							};
3231
3232							var transition = {
3233								rotation : 0,
3234								rotationX : 0,
3235								rotationY : 0,
3236								skewX : 0,
3237								skewY : 0,
3238								scaleX : 1,
3239								scaleY : 1,
3240								ease : lsConvertEasing( nextSubEasing ),
3241								delay : nextSubDelay/1000,
3242								x : 0,
3243								y : 0,
3244								onComplete : function(){
3245									nextSubCallback();
3246								}
3247							};
3248
3249							if( nextSubSlideDir.indexOf('fade') != -1 || ( $(this).data('fadein') !== 'false' && $(this).data('transitiontype') === 'new' ) ){
3250								css['opacity'] = 0;
3251								transition['opacity'] = $(this).data( 'originalOpacity' );
3252							}
3253
3254							// $(this).css( css );
3255
3256							// $(this).stop().delay( curDelay + nextDelay + nextSubDelay ).animate( transition, nextSubTime, nextSubEasing, function(){
3257							// 	if( ls.g.ie78 & $(this).data( 'originalOpacity') === 1 ){
3258							// 		$(this).get(0).style.removeAttribute('filter');
3259							// 	}
3260							// 	nextSubCallback();
3261							// });
3262
3263							if( $(this).data('tr') ){
3264								$(this).data('tr').kill();
3265							}
3266
3267							TweenLite.set( $(this)[0],{
3268								transformPerspective : nextSubPerspective,
3269								transformOrigin : nextSubTransformOrigin
3270							});
3271
3272							$(this).data('tr', TweenLite.fromTo($(this)[0],nextSubTime/1000,css,transition) );
3273						});
3274					};
3275
3276			/* NEW FEATURE v4.0 2D & 3D Layer Transitions */
3277
3278					// Selecting ONE transition (random)
3279					// If the browser doesn't support CSS3 3D, 2D fallback mode will be used instead
3280					// In this case, if user didn't specify any 2D transitions, a random will be selected
3281
3282					var selectTransition = function(){
3283
3284						// if the browser supports CSS3 3D and user specified at least one of 3D transitions
3285
3286						if( lsSupport3D( $(el) ) && ( ls.g.nextLayer.data('transition3d') || ls.g.nextLayer.data('customtransition3d') ) ){
3287
3288							if( ls.g.nextLayer.data('transition3d') && ls.g.nextLayer.data('customtransition3d') ){
3289								var rnd = Math.floor(Math.random() * 2);
3290								var rndT = [['3d',ls.g.nextLayer.data('transition3d')],['custom3d',ls.g.nextLayer.data('customtransition3d')]];
3291								getTransitionType(rndT[rnd][0],rndT[rnd][1]);
3292							}else if( ls.g.nextLayer.data('transition3d') ){
3293								getTransitionType('3d',ls.g.nextLayer.data('transition3d'));
3294							}else{
3295								getTransitionType('custom3d',ls.g.nextLayer.data('customtransition3d'));
3296							}
3297
3298						}else{
3299
3300							if( ls.g.nextLayer.data('transition2d') && ls.g.nextLayer.data('customtransition2d') ){
3301								var rnd = Math.floor(Math.random() * 2);
3302								var rndT = [['2d',ls.g.nextLayer.data('transition2d')],['custom2d',ls.g.nextLayer.data('customtransition2d')]];
3303								getTransitionType(rndT[rnd][0],rndT[rnd][1]);
3304							}else if( ls.g.nextLayer.data('transition2d') ){
3305								getTransitionType('2d',ls.g.nextLayer.data('transition2d'));
3306							}else if( ls.g.nextLayer.data('customtransition2d') ){
3307								getTransitionType('custom2d',ls.g.nextLayer.data('customtransition2d'));
3308							}else{
3309								getTransitionType('2d','1');
3310							}
3311						}
3312					};
3313
3314					// Needed by the demo page
3315
3316					var selectCustomTransition = function(){
3317
3318						if( lsSupport3D( $(el) ) && LSCustomTransition.indexOf('3d') != -1 ){
3319							getTransitionType('3d',LSCustomTransition.split(':')[1]);
3320						}else{
3321							if( LSCustomTransition.indexOf('3d') != -1){
3322								getTransitionType('2d','all');
3323							}else{
3324								getTransitionType('2d',LSCustomTransition.split(':')[1]);
3325							}
3326						}
3327					};
3328
3329					// Choosing layer transition type (2d, 3d, or both)
3330
3331					var getTransitionType = function(type,transitionlist){
3332
3333						var tr = type.indexOf('custom') == -1 ? ls.t : ls.ct;
3334						var tt = '3d', lt, number;
3335
3336						if( type.indexOf('2d') != -1 ){
3337							tt = '2d';
3338						}
3339
3340						if( transitionlist.indexOf('last') != -1 ){
3341							number = tr['t'+tt].length-1;
3342							lt = 'last';
3343						}else if( transitionlist.indexOf('all') != -1){
3344							number = Math.floor(Math.random() * lsCountProp(tr['t'+tt]) );
3345							lt = 'random from all';
3346						}else{
3347							var t = transitionlist.split(',');
3348							var l = t.length;
3349							number = parseInt(t[Math.floor(Math.random() * l)])-1;
3350							lt = 'random from specified';
3351						}
3352
3353						slideTransition(tt,tr['t'+tt][number]);
3354
3355//						$('.test').html('Originals:<br><br>t3D: '+ls.g.nextLayer.data('transition3d')+'<br>t2D: '+ls.g.nextLayer.data('transition2d')+'<br>custom3D: '+ls.g.nextLayer.data('customtransition3d')+'<br>custom2D: '+ls.g.nextLayer.data('customtransition2d')+'<br><br>Support 3D: '+lsSupport3D( $(el) )+'<br><br>Selected transition:<br><br>Type: '+type+' ('+lt+')<br>Number in transition list: '+(number+1)+'<br>Name of the transition: '+tr['t'+tt][number]['name']);
3356					};
3357
3358					// The slideTransition function
3359
3360					var slideTransition = function(type,prop){
3361
3362						var inner = $(el).find('.ls-inner');
3363
3364						// sublayersDurationOut - for future usage
3365
3366						var sublayersDurationOut = ls.g.curLayer.find('*[class*="ls-l"]').length > 0 ? 1000 : 0;
3367
3368						// Detecting a carousel transition - Transition name must have the carousel string
3369
3370						var carousel = prop.name.toLowerCase().indexOf('carousel') == -1 ? false : true;
3371
3372						// Detecting a crossfade transition - Transition name must have the crossfad string
3373
3374						var crossfade = prop.name.toLowerCase().indexOf('crossfad') == -1 ? false : true;
3375
3376						// Calculating cols and rows
3377
3378						var cols = typeof(prop.cols);
3379						var rows = typeof(prop.rows);
3380
3381						switch( cols ){
3382							case 'number':
3383								cols = prop.cols;
3384							break;
3385							case 'string':
3386								cols = Math.floor( Math.random() * ( parseInt( prop.cols.split(',')[1] ) - parseInt( prop.cols.split(',')[0] ) + 1) ) + parseInt( prop.cols.split(',')[0] );
3387							break;
3388							default:
3389								cols = Math.floor( Math.random() * ( prop.cols[1] - prop.cols[0] + 1) ) + prop.cols[0];
3390							break;
3391						}
3392
3393						switch( rows ){
3394							case 'number':
3395								rows = prop.rows;
3396							break;
3397							case 'string':
3398								rows = Math.floor( Math.random() * ( parseInt( prop.rows.split(',')[1] ) - parseInt( prop.rows.split(',')[0] ) + 1) ) + parseInt( prop.rows.split(',')[0] );
3399							break;
3400							default:
3401								rows = Math.floor( Math.random() * ( prop.rows[1] - prop.rows[0] + 1) ) + prop.rows[0];
3402							break;
3403						}
3404
3405						if( ( ls.g.isMobile() == true && ls.o.optimizeForMobile == true ) || ( ls.g.ie78 && ls.o.optimizeForIE78 == true ) ){
3406
3407							// Reducing cols in three steps
3408
3409							if( cols >= 15 ){
3410								cols = 7;
3411							}else if( cols >= 5 ){
3412								cols = 4;
3413							}else if( cols >= 4 ){
3414								cols = 3;
3415							}else if( cols > 2 ){
3416								cols = 2;
3417							}
3418
3419							// Reducing rows in three steps
3420
3421							if( rows >= 15 ){
3422								rows = 7;
3423							}else if( rows >= 5 ){
3424								rows = 4;
3425							}else if( rows >= 4 ){
3426								rows = 3;
3427							}else if( rows > 2 ){
3428								rows = 2;
3429							}
3430
3431							// Reducing more :)
3432
3433							if( rows > 2 && cols > 2 ){
3434								rows = 2;
3435								if( cols > 4){
3436									cols = 4;
3437								}
3438							}
3439						}
3440
3441						var tileWidth = $(el).find('.ls-inner').width() / cols;
3442						var tileHeight = $(el).find('.ls-inner').height() / rows;
3443
3444						// Creating HTML markup for layer transitions
3445
3446						if( !ls.g.ltContainer ){
3447							ls.g.ltContainer = $('<div>').addClass('ls-lt-container').addClass('ls-overflow-hidden').css({
3448								width : inner.width(),
3449								height : inner.height()
3450							}).prependTo( inner );
3451						}else{
3452							ls.g.ltContainer.stop(true,true).empty().css({
3453								display : 'block',
3454								width : inner.width(),
3455								height : inner.height()
3456							});
3457						}
3458
3459						// Setting size
3460
3461						var restW = inner.width() - Math.floor(tileWidth) * cols;
3462						var restH = inner.height() - Math.floor(tileHeight) * rows;
3463
3464						var tileSequence = [];
3465
3466						// IMPROVEMENT v4.1.3 Array-randomizer is now a local function
3467						// Randomize array function
3468
3469						tileSequence.randomize = function() {
3470						  var i = this.length, j, tempi, tempj;
3471						  if ( i == 0 ) return false;
3472						  while ( --i ) {
3473						     j       = Math.floor( Math.random() * ( i + 1 ) );
3474						     tempi   = this[i];
3475						     tempj   = this[j];
3476						     this[i] = tempj;
3477						     this[j] = tempi;
3478						  }
3479						  return this;
3480						}
3481
3482						for(var ts=0; ts<cols * rows; ts++){
3483							tileSequence.push(ts);
3484						}
3485
3486						// Setting the sequences of the transition
3487
3488						switch( prop.tile.sequence ){
3489							case 'reverse':
3490								tileSequence.reverse();
3491							break;
3492							case 'col-forward':
3493								tileSequence = lsOrderArray(rows,cols,'forward');
3494							break;
3495							case 'col-reverse':
3496								tileSequence = lsOrderArray(rows,cols,'reverse');
3497							break;
3498							case 'random':
3499								tileSequence.randomize();
3500							break;
3501						}
3502
3503						var curBG = ls.g.curLayer.find('.ls-bg');
3504						var nextBG = ls.g.nextLayer.find('.ls-bg');
3505
3506						// IMPROVEMENT v4.6.0 If current and next layer both have no BG, skipping the slide transition
3507
3508						if( curBG.length == 0 && nextBG.length == 0 ){
3509							type = '2d';
3510							prop = $.extend(true, {}, ls.t['t2d'][0]);
3511							prop.transition.duration = 1
3512							prop.tile.delay = 0;
3513						}
3514
3515						if( type == '3d' ){
3516							ls.g.totalDuration = ((cols * rows) - 1) * prop.tile.delay;
3517
3518							var stepDuration = 0;
3519
3520							if( prop.before && prop.before.duration ){
3521								stepDuration += prop.before.duration;
3522							}
3523							if( prop.animation && prop.animation.duration ){
3524								stepDuration += prop.animation.duration;
3525							}
3526							if( prop.after && prop.after.duration ){
3527								stepDuration += prop.after.duration;
3528							}
3529
3530							ls.g.totalDuration += stepDuration;
3531
3532							var stepDelay = 0;
3533
3534							if( prop.before && prop.before.delay ){
3535								stepDelay += prop.before.delay;
3536							}
3537							if( prop.animation && prop.animation.delay ){
3538								stepDelay += prop.animation.delay;
3539							}
3540							if( prop.after && prop.after.delay ){
3541								stepDelay += prop.after.delay;
3542							}
3543
3544							ls.g.totalDuration += stepDelay;
3545
3546						}else{
3547							ls.g.totalDuration = ((cols * rows) - 1) * prop.tile.delay + prop.transition.duration;
3548
3549							// IMPROVEMENT v4.5.0 Creating separated containers for current and next tiles
3550
3551							ls.g.curTiles = $('<div>').addClass('ls-curtiles').appendTo( ls.g.ltContainer );
3552							ls.g.nextTiles = $('<div>').addClass('ls-nexttiles').appendTo( ls.g.ltContainer );
3553						}
3554
3555						var pn = ls.g.prevNext;
3556
3557						// Creating cuboids for 3d or tiles for 2d transition (cols * rows)
3558
3559						for(var tiles=0; tiles < cols * rows; tiles++){
3560
3561							var rW = tiles%cols == 0 ? restW : 0;
3562							var rH = tiles > (rows-1)*cols-1 ? restH : 0;
3563
3564							var tile = $('<div>').addClass('ls-lt-tile').css({
3565								width : Math.floor(tileWidth) + rW,
3566								height : Math.floor(tileHeight) + rH
3567							}).appendTo( ls.g.ltContainer );
3568
3569							var curTile, nextTile;
3570
3571							// If current transition is a 3d transition
3572
3573							if( type == '3d' ){
3574
3575								tile.addClass('ls-3d-container');
3576
3577								var W = Math.floor(tileWidth) + rW;
3578								var H = Math.floor(tileHeight) + rH;
3579								var D;
3580
3581								if( prop.animation.direction == 'horizontal' ){
3582									if( Math.abs(prop.animation.transition.rotateY) > 90 && prop.tile.depth != 'large' ){
3583										D = Math.floor( W / 7 ) + rW;
3584									}else{
3585										D = W;
3586									}
3587								}else{
3588									if( Math.abs(prop.animation.transition.rotateX) > 90 && prop.tile.depth != 'large' ){
3589										D = Math.floor( H / 7 ) + rH;
3590									}else{
3591										D = H;
3592									}
3593								}
3594
3595								var W2 = W/2;
3596								var H2 = H/2;
3597								var D2 = D/2;
3598
3599								// createCuboids function will append cuboids with their style settings to their container
3600
3601								var createCuboids = function(c,a,w,h,tx,ty,tz,rx,ry){
3602									$('<div>').addClass(c).css({
3603										width: w,
3604										height: h,
3605										'transform': 'translate3d('+tx+'px, '+ty+'px, '+tz+'px) rotateX('+rx+'deg) rotateY('+ry+'deg) rotateZ(0deg) scale3d(1, 1, 1)',
3606										'-o-transform': 'translate3d('+tx+'px, '+ty+'px, '+tz+'px) rotateX('+rx+'deg) rotateY('+ry+'deg) rotateZ(0deg) scale3d(1, 1, 1)',
3607										'-ms-transform': 'translate3d('+tx+'px, '+ty+'px, '+tz+'px) rotateX('+rx+'deg) rotateY('+ry+'deg) rotateZ(0deg) scale3d(1, 1, 1)',
3608										'-moz-transform': 'translate3d('+tx+'px, '+ty+'px, '+tz+'px) rotateX('+rx+'deg) rotateY('+ry+'deg) rotateZ(0deg) scale3d(1, 1, 1)',
3609										'-webkit-transform': 'translate3d('+tx+'px, '+ty+'px, '+tz+'px) rotateX('+rx+'deg) rotateY('+ry+'deg) rotateZ(0deg) scale3d(1, 1, 1)'
3610									}).appendTo(a);
3611								};
3612
3613								createCuboids('ls-3d-box',tile,0,0,0,0,-D2,0,0);
3614
3615								var backRotX = 0
3616								var topRotX = 0
3617								var bottomRotX = 0
3618
3619								if( prop.animation.direction == 'vertical' && Math.abs(prop.animation.transition.rotateX) > 90){
3620									createCuboids('ls-3d-back',tile.find('.ls-3d-box'),W,H,-W2,-H2,-D2,180,0);
3621								}else{
3622									createCuboids('ls-3d-back',tile.find('.ls-3d-box'),W,H,-W2,-H2,-D2,0,180);
3623								}
3624
3625								createCuboids('ls-3d-bottom',tile.find('.ls-3d-box'),W,D,-W2,H2-D2,0,-90,0
3625);
3626								createCuboids('ls-3d-top',tile.find('.ls-3d-box'),W,D,-W2,-H2-D2,0,90,0);
3627								createCuboids('ls-3d-front',tile.find('.ls-3d-box'),W,H,-W2,-H2,D2,0,0);
3628								createCuboids('ls-3d-left',tile.find('.ls-3d-box'),D,H,-W2-D2,-H2,0,0,-90);
3629								createCuboids('ls-3d-right',tile.find('.ls-3d-box'),D,H,W2-D2,-H2,0,0,90);
3630
3631								curTile = tile.find('.ls-3d-front');
3632
3633								if( prop.animation.direction == 'horizontal' ){
3634									if( Math.abs(prop.animation.transition.rotateY) > 90 ){
3635										nextTile = tile.find('.ls-3d-back');
3636									}else{
3637										nextTile = tile.find('.ls-3d-left, .ls-3d-right');
3638									}
3639								}else{
3640									if( Math.abs(prop.animation.transition.rotateX) > 90 ){
3641										nextTile = tile.find('.ls-3d-back');
3642									}else{
3643										nextTile = tile.find('.ls-3d-top, .ls-3d-bottom');
3644									}
3645								}
3646
3647								// Animating cuboids
3648
3649								var curCubDelay = tileSequence[tiles] * prop.tile.delay;
3650
3651								var curCub = ls.g.ltContainer.find('.ls-3d-container:eq('+tiles+') .ls-3d-box');
3652
3653								var tl = new TimelineLite();
3654
3655								if( prop.before && prop.before.transition ){
3656									prop.before.transition.delay = prop.before.transition.delay ? (prop.before.transition.delay + curCubDelay)/1000 : curCubDelay/1000;
3657									tl.to( curCub[0],prop.before.duration/1000,lsConvertTransition( prop.before.transition, prop.before.easing ));
3658								}else{
3659									prop.animation.transition.delay = prop.animation.transition.delay ? (prop.animation.transition.delay + curCubDelay)/1000 : curCubDelay/1000;
3660								}
3661
3662								tl.to( curCub[0],prop.animation.duration/1000,lsConvertTransition( prop.animation.transition, prop.animation.easing ));
3663
3664								if( prop.after ){
3665									if( !prop.after.transition ){
3666										prop.after.transition = {};
3667									}
3668									tl.to( curCub[0],prop.after.duration/1000,lsConvertTransition( prop.after.transition, prop.after.easing, 'after' ));
3669								}
3670
3671							}else{
3672
3673								// If current transition is a 2d transition
3674
3675								var T1 = L1 = T2 = L2 = 'auto';
3676								var O1 = O2 = 1;
3677
3678								if( prop.transition.direction == 'random' ){
3679									var dir = ['top','bottom','right','left'];
3680									var direction = dir[Math.floor(Math.random() * dir.length )];
3681								}else{
3682									var direction = prop.transition.direction;
3683								}
3684
3685								// IMPROVEMENT v4.5.0 Reversing animation directions if slider is moving backwards
3686
3687								if( prop.name.toLowerCase().indexOf('mirror') != -1 && tiles%2 == 0 ){
3688									if( pn == 'prev' ){
3689										pn = 'next';
3690									}else{
3691										pn = 'prev';
3692									}
3693								}
3694
3695								if( pn == 'prev' ){
3696
3697									switch( direction ){
3698										case 'top':
3699											direction = 'bottom';
3700										break;
3701										case 'bottom':
3702											direction = 'top';
3703										break;
3704										case 'left':
3705											direction = 'right';
3706										break;
3707										case 'right':
3708											direction = 'left';
3709										break;
3710										case 'topleft':
3711											direction = 'bottomright';
3712										break;
3713										case 'topright':
3714											direction = 'bottomleft';
3715										break;
3716										case 'bottomleft':
3717											direction = 'topright';
3718										break;
3719										case 'bottomright':
3720											direction = 'topleft';
3721										break;
3722									}
3723								}
3724
3725								switch( direction ){
3726									case 'top':
3727										T1 = T2 = -tile.height();
3728										L1 = L2 = 0;
3729									break;
3730									case 'bottom':
3731										T1 = T2 = tile.height();
3732										L1 = L2 = 0;
3733									break;
3734									case 'left':
3735										T1 = T2 = 0;
3736										L1 = L2 = -tile.width();
3737									break;
3738									case 'right':
3739										T1 = T2 = 0;
3740										L1 = L2 = tile.width();
3741									break;
3742									case 'topleft':
3743										T1 = tile.height();
3744										T2 = 0;
3745										L1 = tile.width();
3746										L2 = 0;
3747									break;
3748									case 'topright':
3749										T1 = tile.height();
3750										T2 = 0;
3751										L1 = - tile.width();
3752										L2 = 0;
3753									break;
3754									case 'bottomleft':
3755										T1 = - tile.height();
3756										T2 = 0;
3757										L1 = tile.width();
3758										L2 = 0;
3759									break;
3760									case 'bottomright':
3761										T1 = - tile.height();
3762										T2 = 0;
3763										L1 = - tile.width();
3764										L2 = 0;
3765									break;
3766								}
3767
3768								ls.g.scale2D = prop.transition.scale ? prop.transition.scale : 1;
3769
3770								if( carousel == true && ls.g.scale2D != 1 ){
3771
3772									T1 = T1 / 2;
3773									T2 = T2 / 2;
3774									L1 = L1 / 2;
3775									L2 = L2 / 2;
3776								}
3777
3778								// Selecting the type of the transition
3779
3780//								if( !ls.g.ie78 || ( ls.g.ie78 && !ls.o.optimizeForIE78 ) ||  ( ls.g.ie78 && ls.o.optimizeForIE78 == true && prop.name.toLowerCase().indexOf('crossfade') != -1 ) ){
3781									switch( prop.transition.type ){
3782										case 'fade':
3783											T1 = T2 = L1 = L2 = 0;
3784											O1 = 0;
3785											O2 = 1;
3786										break;
3787										case 'mixed':
3788										O1 = 0;
3789										O2 = 1;
3790										if( ls.g.scale2D == 1 ){
3791											T2 = L2 = 0;
3792										}
3793										break;
3794									}
3795//								}
3796
3797								// IMPROVEMENT v4.5.0 Implemented Rotation and Scale into 2D Transitions
3798
3799								if((( prop.transition.rotate || prop.transition.rotateX || prop.transition.rotateY ) || ls.g.scale2D != 1 ) && !ls.g.ie78 && prop.transition.type != 'slide' ){
3800									tile.css({
3801										overflow : 'visible'
3802									});
3803								}else{
3804									tile.css({
3805										overflow : 'hidden'
3806									});
3807								}
3808
3809								if( carousel == true){
3810									ls.g.curTiles.css({
3811										overflow: 'visible'
3812									});
3813								}else{
3814									ls.g.curTiles.css({
3815										overflow: 'hidden'
3816									});
3817								}
3818
3819								if( crossfade == true || prop.transition.type == 'slide' || carousel == true ){
3820									var tileInCur = tile.appendTo( ls.g.curTiles );
3821									var tileInNext = tile.clone().appendTo( ls.g.nextTiles );
3822									curTile = $('<div>').addClass('ls-curtile').appendTo( tileInCur );
3823								}else{
3824									var tileInNext = tile.appendTo( ls.g.nextTiles );
3825								}
3826
3827								nextTile = $('<div>').addClass('ls-nexttile').appendTo( tileInNext ).css({
3828									top : -T1,
3829									left : -L1,
3830									dispay : 'block',
3831									opacity : O1
3832								});
3833
3834								// Animating tiles
3835
3836								var curTileDelay = tileSequence[tiles] * prop.tile.delay;
3837
3838								// IMPROVEMENT v4.5.0 Implemented various types of rotations into 2D Transitions
3839
3840								var r = prop.transition.rotate ? prop.transition.rotate : 0;
3841								var rX = prop.transition.rotateX ? prop.transition.rotateX : 0;
3842								var rY = prop.transition.rotateY ? prop.transition.rotateY : 0;
3843
3844								// Reversing rotation degrees if slider is moving backwards
3845
3846								if( pn == 'prev' ){
3847									r = -r;
3848									rX = -rX;
3849									rY = -rY;
3850								}
3851
3852								TweenLite.fromTo(nextTile[0],prop.transition.duration/1000,{
3853									rotation : r,
3854									rotationX : rX,
3855									rotationY : rY,
3856									scale : ls.g.scale2D
3857								},{
3858									delay : curTileDelay / 1000,
3859									top : 0,
3860									left : 0,
3861									opacity : O2,
3862									rotation : 0,
3863									rotationX : 0,
3864									rotationY : 0,
3865									scale : 1,
3866									ease : lsConvertEasing( prop.transition.easing )
3867								});
3868
3869								// IMPROVEMENT v5.0.0 Smart crossfading for semi-transparent PNG and different size JPG backgrounds
3870
3871								if(
3872									crossfade == true && (
3873										nextBG.length < 1 || (
3874											nextBG.length > 0 && (
3875												nextBG.attr('src').toLowerCase().indexOf('png') != -1 || (
3876													nextBG.width() < ls.g.sliderWidth() || nextBG.height() < ls.g.sliderHeight()
3877												)
3878											)
3879										)
3880									)
3881								){
3882									TweenLite.to(curTile[0],prop.transition.duration/1000,{
3883										delay : curTileDelay / 1000,
3884										opacity : 0,
3885										ease : lsConvertEasing( prop.transition.easing )
3886									});
3887								}
3888
3889								if( ( prop.transition.type == 'slide' || carousel == true ) && prop.name.toLowerCase().indexOf('mirror') == -1 ){
3890
3891									var r2 = 0;
3892
3893									if( r != 0 ){
3894										r2 = -r;
3895									}
3896
3897									TweenLite.to(curTile[0],prop.transition.duration/1000,{
3898										delay : curTileDelay / 1000,
3899										top : T2,
3900										left : L2,
3901										rotation : r2,
3902										scale : ls.g.scale2D,
3903										opacity: O1,
3904										ease : lsConvertEasing( prop.transition.easing )
3905									});
3906								}
3907							}
3908
3909							// Appending the background images of current and next layers into the tiles on both of 2d & 3d transitions
3910							// BUGFIX v5.0.0 added Math.floor to prevent '1px bug' under Safari and Firefox
3911
3912							if( curBG.length ){
3913								if( type == '3d' || ( type == '2d' && ( crossfade == true || prop.transition.type == 'slide' || carousel == true ) ) ){
3914									curTile.append($('<img>').attr('src', curBG.attr('src')).css({
3915										width : curBG[0].style.width,
3916										height : curBG[0].style.height,
3917										marginLeft : parseFloat(curBG.css('margin-left')) - parseFloat(tile.position().left),
3918										marginTop : parseFloat(curBG.css('margin-top')) - parseFloat(tile.position().top)
3919									}));
3920								}else if( ls.g.curTiles.children().length == 0 ){
3921									ls.g.curTiles.append($('<img>').attr('src', curBG.attr('src')).css({
3922										width : curBG[0].style.width,
3923										height : curBG[0].style.height,
3924										marginLeft : parseFloat(curBG.css('margin-left')),
3925										marginTop : parseFloat(curBG.css('margin-top'))
3926									}));
3927
3928								}
3929							}
3930
3931							if( nextBG.length ){
3932								nextTile.append($('<img>').attr('src', nextBG.attr('src') ).css({
3933									width : nextBG[0].style.width,
3934									height : nextBG[0].style.height,
3935									marginLeft : parseFloat(nextBG.css('margin-left')) - parseFloat(tile.position().left),
3936									marginTop : parseFloat(nextBG.css('margin-top')) - parseFloat(tile.position().top)
3937								}));
3938							}
3939						}
3940
3941						// Storing current and next layer elements in a local variable (needed by setTimeout functions in some cases)
3942
3943						var curLayer = ls.g.curLayer;
3944						var nextLayer = ls.g.nextLayer;
3945
3946						// Hiding the background image of the current and next layers (immediately)
3947
3948						setTimeout(function(){
3949							curLayer.find('.ls-bg').css({
3950								visibility : 'hidden'
3951							});
3952						},50);
3953
3954						nextLayer.find('.ls-bg').css({
3955							visibility : 'hidden'
3956						});
3957						ls.g.ltContainer.removeClass('ls-overflow-hidden');
3958
3959						// Sliding out the sublayers of the current layer
3960						// (immediately, delay out and duration out properties are not applied to the sublayers during the new layer transitions)
3961
3962						curSubLayers(sublayersDurationOut);
3963
3964						// Hiding current layer after its sublayers animated out
3965
3966						setTimeout(function(){
3967							curLayer.css({
3968								width: 0
3969							});
3970						},sublayersDurationOut );
3971
3972						// Calculating next layer delay
3973
3974						var nextLayerTimeShift = parseInt(nextLayer.data('timeshift')) ? parseInt(nextLayer.data('timeshift')) : 0;
3975						var nextLayerDelay = ls.g.totalDuration + nextLayerTimeShift > 0 ? ls.g.totalDuration + nextLayerTimeShift : 0;
3976
3977						// Showing next layer and sliding sublayers of the next layer in after the current layer transition ended
3978
3979						setTimeout(function(){
3980							if( ls.g.resize == true ){
3981								ls.g.ltContainer.empty();
3982								curLayer.removeClass('ls-active');
3983								ls.makeResponsive( nextLayer, function(){
3984									ls.g.resize = false;
3985								});
3986							}
3987
3988							// Sliding in / fading in the sublayers of the next layer
3989
3990							nextSubLayers();
3991
3992							// NEW FEATURE v4.6.0 Hiding background if the next layer has png BG or has no BG
3993							// BUGFIX v4.6.1 Changed some properties to prevent flickering
3994
3995							if( nextLayer.find('.ls-bg').length < 1 || ( nextLayer.find('.ls-bg').length > 0 && nextLayer.find('.ls-bg').attr('src').toLowerCase().indexOf('png') != -1 ) ){
3996
3997								ls.g.ltContainer.delay(350).fadeOut(300,function(){
3998									$(this).empty().show();
3999								});
4000							}
4001
4002							// Displaying the next layer (immediately)
4003
4004							nextLayer.css({
4005								width : ls.g.sliderWidth(),
4006								height : ls.g.sliderHeight()
4007							});
4008						}, nextLayerDelay );
4009
4010						// BUGFIX v5.0.1 Added a minimal value of ls.g.totalDuration
4011						// CHANGED in v5.1.0 due to a fading issue in carousel transition
4012
4013						if( ls.g.totalDuration < 300 ){
4014							ls.g.totalDuration = 1000;
4015						}
4016
4017						// Changing visibility to visible of the background image of the next layer and overflow to hidden of .ls-lt-container after the transition and calling callback function
4018
4019						setTimeout(function(){
4020							ls.g.ltContainer.addClass('ls-overflow-hidden');
4021
4022							nextLayer.addClass('ls-active');
4023
4024							if( nextLayer.find('.ls-bg').length ){
4025
4026								nextLayer.find('.ls-bg').css({
4027									display : 'none',
4028									visibility : 'visible'
4029								});
4030								if( ls.g.ie78 ){
4031									nextLayer.find('.ls-bg').css('display','block');
4032									setTimeout(function(){
4033										curLayerCallback();
4034									},500);
4035								}else{
4036									nextLayer.find('.ls-bg').fadeIn(500, function(){
4037										curLayerCallback();
4038									});
4039								}
4040							}else{
4041								curLayerCallback();
4042							}
4043
4044						}, ls.g.totalDuration );
4045					};
4046
4047
4048
4049			/* Selecting and running the transition */
4050
4051					var tType = ( ( ls.g.nextLayer.data('transition3d') || ls.g.nextLayer.data('transition2d') ) && ls.t ) || ( ( ls.g.nextLayer.data('customtransition3d') || ls.g.nextLayer.data('customtransition2d') ) && ls.ct ) ? 'new' : 'old';
4052
4053					if( !ls.g.nextLayer.data('transitiontype') ){
4054						ls.transitionType( ls.g.nextLayer );
4055					}
4056
4057					if( ls.g.nextLayer.data('transitiontype') === 'new' ){
4058						tType = 'new';
4059					}
4060
4061					if( ls.o.slideTransition ){
4062						tType = 'forced';
4063					}
4064					if( ls.o.animateFirstSlide && !ls.g.firstSlideAnimated ){
4065
4066						// BUGFIX v3.5 there is no need to animate 'current' layer if the following conditions are true
4067						//			   this fixes the sublayer animation direction bug
4068
4069						if( ls.g.layersNum == 1 ){
4070							var curDelay = 0;
4071
4072							// IMPROVEMENT v4.1.0 Calling cbAnimStop(); function if only one layer is in the slider
4073
4074							ls.o.cbAnimStop(ls.g);
4075
4076						}else{
4077							var nextLayerTimeShift = parseInt(ls.g.nextLayer.data('timeshift')) ? parseInt(ls.g.nextLayer.data('timeshift')) : 0;
4078							var d = tType == 'new' ? 0 : curDuration;
4079							ls.g.t5 = setTimeout(function(){
4080								curLayerCallback();
4081							}, d + Math.abs(nextLayerTimeShift) );
4082						}
4083
4084						// curDelay must be 0!
4085
4086						ls.g.totalDuration = true;
4087
4088						// Animating SUBLAYERS of the first layer
4089
4090						nextSubLayers();
4091
4092						// Displaying the first layer (immediately)
4093
4094						ls.g.nextLayer.css({
4095							width : ls.g.sliderWidth(),
4096							height : ls.g.sliderHeight()
4097						});
4098
4099						if( !ls.g.ie78 ){
4100							ls.g.nextLayer.find('.ls-bg').css({
4101								display : 'none'
4102							}).fadeIn(500);
4103						}
4104
4105						ls.g.firstSlideAnimated = true;
4106						ls.g.isLoading = false;
4107					}else{
4108
4109						switch(tType){
4110
4111							// Old transitions (sliding layers)
4112
4113							case 'old':
4114
4115								ls.g.totalDuration = false;
4116
4117								// BUGFIX v4.5.0 Removing elements from ls-lt-container is necessary
4118
4119								if( ls.g.ltContainer ){
4120									ls.g.ltContainer.empty();
4121								}
4122
4123								// Animating CURRENT LAYER and its SUBLAYERS
4124
4125								curLayer();
4126								curSubLayers();
4127
4128								// Animating NEXT LAYER and its SUBLAYERS
4129
4130								nextLayer();
4131								nextSubLayers();
4132							break;
4133
4134							// NEW FEATURE v4.0 2D & 3D Layer Transitions
4135
4136							case 'new':
4137
4138								if( typeof LSCustomTransition != 'undefined' ){
4139									selectCustomTransition();
4140								}else{
4141									selectTransition();
4142								}
4143							break;
4144
4145							case 'forced':
4146								slideTransition( ls.o.slideTransition.type, ls.o.slideTransition.obj );
4147							break;
4148						}
4149					}
4150		};
4151
4152		ls.transitionType = function( el ){
4153
4154			var ttype =  el.data('ls') ||
4155								( 	!el.data('ls') &&
4156									!el.data('slidedelay') &&
4157									!el.data('slidedirection') &&
4158									!el.data('slideoutdirection') &&
4159									!el.data('delayin') &&
4160									!el.data('delayout') &&
4161									!el.data('durationin') &&
4162									!el.data('durationout') &&
4163									!el.data('showuntil') &&
4164									!el.data('easingin') &&
4165									!el.data('easingout') &&
4166									!el.data('scalein') &&
4167									!el.data('scaleout') &&
4168									!el.data('rotatein') &&
4169									!el.data('rotateout')
4170								) ? 'new' : 'old';
4171			el.data('transitiontype', ttype);
4172		};
4173
4174		ls.sublayerShowUntil = function( sublayer ){
4175
4176			if( !sublayer.data('transitiontype') ){
4177				ls.transitionType( sublayer );
4178			}
4179
4180			// BUGFIX v5.1.0 Removing ls-videohack class before starting transition
4181
4182			sublayer.removeClass('ls-videohack');
4183
4184			var prevOrNext = ls.g.curLayer;
4185
4186			if( ls.g.prevNext != 'prev' && ls.g.nextLayer ){
4187				prevOrNext = ls.g.nextLayer;
4188			}
4189
4190			var chooseDirection = prevOrNext.data('slidedirection') ? prevOrNext.data('slidedirection') : ls.o.slideDirection;
4191
4192			// Setting the direction of sliding
4193
4194			var slideDirection = ls.g.slideDirections[ls.g.prevNext][chooseDirection];
4195
4196			var curSubSlideDir = sublayer.data('slidedirection') ? sublayer.data('slidedirection') : slideDirection;
4197			var lml, lmt;
4198
4199			switch(curSubSlideDir){
4200				case 'left':
4201					lml = -ls.g.sliderWidth();
4202					lmt = 0;
4203					break;
4204				case 'right':
4205					lml = ls.g.sliderWidth();
4206					lmt = 0;
4207					break;
4208				case 'top':
4209					lmt = -ls.g.sliderHeight();
4210					lml = 0;
4211					break;
4212				case 'bottom':
4213					lmt = ls.g.sliderHeight();
4214					lml = 0;
4215					break;
4216				case 'fade':
4217					lmt = 0;
4218					lml = 0;
4219					break;
4220			}
4221
4222			// NEW FEATURE v1.6 added slideoutdirection to sublayers
4223			// NEW FEATURES 5.0.0 added axis-free transitions with offsetx and offsety properties
4224
4225			if( sublayer.data('transitiontype') === 'new' ){
4226				var curSubSlideOutDir = 'new';
4227			}else{
4228				var curSubSlideOutDir = sublayer.data('slideoutdirection') ? sublayer.data('slideoutdirection') : false;
4229			}
4230
4231			switch(curSubSlideOutDir){
4232				case 'left':
4233					lml = ls.g.sliderWidth();
4234					lmt = 0;
4235					break;
4236				case 'right':
4237					lml = -ls.g.sliderWidth();
4238					lmt = 0;
4239					break;
4240				case 'top':
4241					lmt = ls.g.sliderHeight();
4242					lml = 0;
4243					break;
4244				case 'bottom':
4245					lmt = -ls.g.sliderHeight();
4246					lml = 0;
4247					break;
4248				case 'fade':
4249					lmt = 0;
4250					lml = 0;
4251					break;
4252				case 'new':
4253					if( sublayer.data('offsetxout') ){
4254						if( sublayer.data('offsetxout') === 'left' ){
4255							lml = ls.g.sliderWidth();
4256						}else if( sublayer.data('offsetxout') === 'right' ){
4257							lml = -ls.g.sliderWidth();
4258						}else{
4259							lml = -parseInt( sublayer.data('offsetxout') );
4260						}
4261					}else{
4262						lml = -ls.lt.offsetXOut;
4263					}
4264					if( sublayer.data('offsetyout') ){
4265						if( sublayer.data('offsetyout') === 'top' ){
4266							lmt = ls.g.sliderHeight();
4267						}else if( sublayer.data('offsetyout') === 'bottom' ){
4268							lmt = -ls.g.sliderHeight();
4269						}else{
4270							lmt = -parseInt( sublayer.data('offsetyout') );
4271						}
4272					}else{
4273						lmt = -ls.lt.offsetYOut;
4274					}
4275					break;
4276			}
4277
4278			// NEW FEATURE v4.5.0 Rotating & Scaling sublayers
4279			// BUGFIX v4.5.5 changing the default value from 0 to 'none' (because of old jQuery, 1.7.2)
4280			// NEW FEATURES v5.0.0 Added SkewX, SkewY, ScaleX, ScaleY, RotateX & RotateY transitions
4281
4282			var curSubRotate = curSubRotateX = curSubRotateY = curSubScale = curSubSkewX = curSubSkewY = curSubScaleX = curSubScaleY = 'none';
4283//			if( !ls.g.ie78 && ls.g.enableCSS3 ){
4284				curSubRotate = sublayer.data('rotateout') ? sublayer.data('rotateout') : ls.lt.rotateOut;
4285				curSubRotateX = sublayer.data('rotatexout') ? sublayer.data('rotatexout') : ls.lt.rotateXOut;
4286				curSubRotateY = sublayer.data('rotateyout') ? sublayer.data('rotateyout') : ls.lt.rotateYOut;
4287				curSubScale = sublayer.data('scaleout') ? sublayer.data('scaleout') : ls.lt.scaleOut;
4288				curSubSkewX = sublayer.data('skewxout') ? sublayer.data('skewxout') : ls.lt.skewXOut;
4289				curSubSkewY = sublayer.data('skewyout') ? sublayer.data('skewyout') : ls.lt.skewYOut;
4290				if( curSubScale === 1 ){
4291					curSubScaleX = sublayer.data('scalexout') ? sublayer.data('scalexout') : ls.lt.scaleXOut;
4292					curSubScaleY = sublayer.data('scaleyout') ? sublayer.data('scaleyout') : ls.lt.scaleYOut;
4293				}else{
4294					curSubScaleX = curSubScaleY = curSubScale;
4295				}
4296				var too = sublayer.data('transformoriginout') ? sublayer.data('transformoriginout').split(' ') : ls.lt.transformOriginOut;
4297
4298				for(var t =0;t<too.length;t++){
4299					if( too[t].indexOf('%') === -1 && too[t].indexOf('left') !== -1 && too[t].indexOf('right') !== -1 && too[t].indexOf('top') !== -1 && too[t].indexOf('bottom') !== -1 ){
4300						too[t] = '' + parseInt( too[t] ) * ls.g.ratio + 'px';
4301					}
4302				}
4303				var curSubTransformOrigin = too.join(' ');
4304				var curSubPerspective = sublayer.data('perspectiveout') ? sublayer.data('perspectiveout') : ls.lt.perspectiveOut;
4305
4306//			}
4307
4308			// IMPROVEMENT v4.0 Distance (P.level): -1
4309
4310			var endLeft = parseInt( sublayer.css('left') );
4311			var endTop = parseInt( sublayer.css('top') );
4312
4313			var curSubPLevel = parseInt( sublayer.attr('class').split('ls-l')[1] );
4314
4315			var wh = sublayer.outerWidth() > sublayer.outerHeight() ? sublayer.outerWidth() : sublayer.outerHeight();
4316			var modX = parseInt( curSubRotate ) === 0 ? sublayer.outerWidth() : wh;
4317			var modY = parseInt( curSubRotate ) === 0 ? sublayer.outerHeight() : wh;
4318
4319			if( ( curSubPLevel === -1 && curSubSlideOutDir !== 'new' ) || ( sublayer.data('offsetxout') === 'left' || sublayer.data('offsetxout') === 'right' ) ){
4320				if( lml < 0 ){
4321					lml = - ( ls.g.sliderWidth() - endLeft + ( curSubScaleX / 2 - .5 ) * modX + 100  );
4322				}else if( lml > 0 ){
4323					lml = endLeft + ( curSubScaleX / 2 + .5 ) * modX + 100;
4324				}
4325			}else{
4326				lml = lml * ls.g.ratio;
4327			}
4328
4329			if( ( curSubPLevel === -1 && curSubSlideOutDir !== 'new' ) || ( sublayer.data('offsetyout') === 'top' || sublayer.data('offsetyout') === 'bottom' ) ){
4330				if( lmt < 0 ){
4331					lmt = - ( ls.g.sliderHeight() - endTop + ( curSubScaleY / 2 - .5 ) * modY + 100  );
4332				}else if( lmt > 0 ){
4333					lmt = endTop + ( curSubScaleY / 2 + .5 ) * modY + 100;
4334				}
4335			}else{
4336				lmt = lmt * ls.g.ratio;
4337			}
4338
4339			if( curSubPLevel === -1 || curSubSlideOutDir === 'new' ){
4340				var curSubPar = 1;
4341			}else{
4342				var curSubParMod = ls.g.curLayer.data('parallaxout') ? parseInt(ls.g.curLayer.data('parallaxout')) : ls.o.parallaxOut;
4343				var curSubPar = curSubPLevel * curSubParMod;
4344			}
4345
4346//			var curSubDelay = parseInt( sublayer.data('showuntil') );
4347
4348			if( sublayer.data('transitiontype') === 'new' ){
4349				var duO = ls.lt.durationOut;
4350				var eO = ls.lt.easingOut;
4351			}else{
4352				var duO = ls.o.durationOut;
4353				var eO = ls.o.easingOut;
4354			}
4355
4356			var curSubTime = sublayer.data('durationout') ? parseInt(sublayer.data('durationout')) : duO;
4357			var curSubEasing = sublayer.data('easingout') ? sublayer.data('easingout') : eO;
4358
4359			var css = {
4360				visibility : 'hidden'
4361			};
4362
4363			var transition = {
4364				rotation : curSubRotate,
4365				rotationX : curSubRotateX,
4366				rotationY : curSubRotateY,
4367				skewX : curSubSkewX,
4368				skewY : curSubSkewY,
4369				scaleX : curSubScaleX,
4370				scaleY : curSubScaleY,
4371				x : -lml * curSubPar,
4372				y : -lmt * curSubPar,
4373				ease : lsConvertEasing( curSubEasing ),
4374				onComplete : function(){
4375					sublayer.css( css );
4376				}
4377			};
4378
4379			if( curSubSlideOutDir == 'fade' || ( !curSubSlideOutDir && curSubSlideDir == 'fade' ) || ( sublayer.data('fadeout') !== 'false' && sublayer.data('transitiontype') === 'new' ) ){
4380				transition['opacity'] = 0;
4381				css['opacity'] = sublayer.data( 'originalOpacity' );
4382			}
4383
4384			TweenLite.set( sublayer[0],{
4385				transformPerspective : curSubPerspective,
4386				transformOrigin : curSubTransformOrigin
4387			});
4388
4389			TweenLite.to(sublayer[0],curSubTime/1000,transition);
4390
4391			// sublayer.stop(true,false).animate( transition, curSubTime, curSubEasing,function(){
4392			// 	sublayer.css( css );
4393			// });
4394		};
4395
4396		// v3.6 Improved Debug Mode
4397
4398		ls.debug = function(){
4399
4400			ls.d = {
4401				history : $('<div>'),
4402				// adds a H1 (title)
4403				aT : function(content){
4404					$('<h1>'+content+'</h1>').appendTo( ls.d.history );
4405				},
4406				// adds an empty UL
4407				aeU : function(){
4408					$('<ul>').appendTo( ls.d.history );
4409				},
4410				// adds an UL with a LI
4411				aU : function(content){
4412					$('<ul><li>'+content+'</li></ul>').appendTo( ls.d.history );
4413				},
4414				// adds a LI into the last UL
4415				aL : function(content){
4416					$('<li>'+content+'</li>').appendTo( ls.d.history.find('ul:last') );
4417				},
4418				// adds an UL into the last LI of the last UL
4419				aUU : function(content){
4420					$('<ul>').appendTo( ls.d.history.find('ul:last li:last') );
4421				},
4422				// adds a Function to the first LI inside the last UL
4423				aF : function(elem){
4424					ls.d.history.find('ul:last li:last').hover(
4425						function(){
4426							elem.css({
4427								border: '2px solid red',
4428								marginTop : parseInt( elem.css('margin-top') ) - 2,
4429								marginLeft : parseInt( elem.css('margin-left') ) - 2
4430							});
4431						},
4432						function(){
4433							elem.css({
4434								border: '0px',
4435								marginTop : parseInt( elem.css('margin-top') ) + 2,
4436								marginLeft : parseInt( elem.css('margin-left') ) + 2
4437							});
4438						}
4439					);
4440				},
4441				show : function(){
4442					if( !$('body').find('.ls-debug-console').length ){
4443
4444						if( !ls.d.putData ){
4445
4446							// Init code
4447
4448							ls.d.aT('Init code');
4449							ls.d.aeU();
4450
4451							for( var prop in ls.o ){
4452								ls.d.aL(prop+': <strong>' + ls.o[prop] + '</strong>');
4453							}
4454
4455//							ls.d.aL('sliderOriginalWidth: <strong>' + ls.g.sliderOriginalWidth + '</strong>');
4456//							ls.d.aL('sliderOriginalHeight: <strong>' + ls.g.sliderOriginalHeight + '</strong>');
4457
4458							// Slides, layers data
4459
4460							ls.d.aT('LayerSlider Content');
4461							ls.d.aU('Number of slides found: <strong>' + $(el).find('.ls-slide').length + '</strong>');
4462
4463							$(el).find('.ls-inner .ls-slide, .ls-inner *[class*="ls-l"]').each(function(){
4464
4465								if( $(this).hasClass('ls-slide') ){
4466									ls.d.aU('<strong>SLIDE ' + ( $(this).index() + 1 ) + '</strong>');
4467									ls.d.aUU();
4468									ls.d.aL('<strong>SLIDE ' + ( $(this).index() + 1 ) + ' properties:</strong><br><br>');
4469								}else{
4470									ls.d.aU('&nbsp;&nbsp;&nbsp;&nbsp;Layer ( '+$(this).prop('tagName')+' )');
4471									ls.d.aF($(this));
4472									ls.d.aUU();
4473									ls.d.aL('<strong>'+$(this).prop('tagName')+' layer properties:</strong><br><br>');
4474									ls.d.aL('distance / class: <strong>'+$(this).attr('class')+'</strong>');
4475								}
4476
4477								$.each( $(this).data(),function(name, val) {
4478									ls.d.aL( name +': <strong>' + val + '</strong>');
4479								});
4480							});
4481
4482							ls.d.putData = true;
4483						}
4484
4485						var dc = $('<div>').addClass('ls-debug-console').css({
4486							position: 'fixed',
4487							zIndex: '10000000000',
4488							top: '10px',
4489							right: '10px',
4490							width: '300px',
4491							padding: '20px',
4492							background: 'black',
4493							'border-radius': '10px',
4494							height: $(window).height() - 60,
4495							opacity: 0,
4496							marginRight: 150
4497						}).appendTo( $('body') ).css({
4498							marginRight: 0,
4499							opacity: .9
4500						}).click(function(e){
4501							if(e.shiftKey && e.altKey){
4502								$(this).remove();
4503							}
4504						});
4505						var ds = $('<div>').css({
4506							width: '100%',
4507							height: '100%',
4508							overflow: 'auto'
4509						}).appendTo( dc );
4510						var dd = $('<div>').css({
4511							width: '100%'
4512						}).appendTo( ds ).append( ls.d.history );
4513					}
4514				},
4515				hide : function(){
4516					$('body').find('.ls-debug-console').remove();
4517				}
4518			};
4519
4520			$(el).click(function(e){
4521				if(e.shiftKey && e.altKey){
4522					ls.d.show();
4523				}
4524			});
4525		};
4526
4527		// initializing
4528		ls.load();
4529	};
4530
4531	var lsConvertEasing = function( e ){
4532
4533		var t;
4534
4535		if( e.toLowerCase().indexOf('swing') !== -1 || e.toLowerCase().indexOf('linear') !== -1 ){
4536			t = Linear.easeNone;
4537		}else if( e.toLowerCase().indexOf('easeinout') !== -1 ){
4538			var ee = e.toLowerCase().split('easeinout')[1];
4539			t = window[ee.charAt(0).toUpperCase() + ee.slice(1)].easeInOut;
4540		}else if( e.toLowerCase().indexOf('easeout') !== -1 ){
4541			var ee = e.toLowerCase().split('easeout')[1];
4542			t = window[ee.charAt(0).toUpperCase() + ee.slice(1)].easeOut;
4543		}else if( e.toLowerCase().indexOf('easein') !== -1 ){
4544			var ee = e.toLowerCase().split('easein')[1];
4545			t = window[ee.charAt(0).toUpperCase() + ee.slice(1)].easeIn;
4546		}
4547
4548		return t;
4549	};
4550
4551	var lsConvertTransition = function( t, e, type, undef ){
4552
4553		if( typeof e === 'undefined' ){
4554			var e = 'easeInOutQuart';
4555		}
4556		var tt = {};
4557
4558		if( t.rotate !== undef ){
4559			tt.rotation = t.rotate;
4560		}
4561		if( t.rotateY !== undef ){
4562			tt.rotationY = t.rotateY;
4563		}
4564		if( t.rotateX !== undef ){
4565			tt.rotationX = t.rotateX;
4566		}
4567		if( type === 'after' ){
4568			tt.scaleX = tt.scaleY = tt.scaleZ = 1;
4569		}else if( t.scale3d !== undef ){
4570			tt.scaleX = tt.scaleY = tt.scaleZ = t.scale3d;
4571		}
4572
4573		if( t.delay ){
4574			tt.delay = type === 'after' ? t.delay/1000 : t.delay;
4575		}
4576
4577		tt.ease = lsConvertEasing( e );
4578
4579		return tt;
4580	};
4581
4582	// Support3D checks the CSS3 3D capability of the browser (based on the idea of Modernizr.js)
4583
4584	var lsSupport3D = function( el ) {
4585
4586		var testEl = $('<div>'),
4587			s3d1 = false,
4588			s3d2 = false,
4589			properties = ['perspective', 'OPerspective', 'msPerspective', 'MozPerspective', 'WebkitPerspective'];
4590			transform = ['transformStyle','OTransformStyle','msTransformStyle','MozTransformStyle','WebkitTransformStyle'];
4591
4592		for (var i = properties.length - 1; i >= 0; i--){
4593			s3d1 = s3d1 ? s3d1 : testEl[0].style[properties[i]] != undefined;
4594		};
4595
4596		// preserve 3D test
4597
4598		for (var i = transform.length - 1; i >= 0; i--){
4599			testEl.css( 'transform-style', 'preserve-3d' );
4600			s3d2 = s3d2 ? s3d2 : testEl[0].style[transform[i]] == 'preserve-3d';
4601		};
4602
4603		// If browser has perspective capability and it is webkit, we must check it with this solution because Chrome can give false positive result if GPU acceleration is disabled
4604
4605        if (s3d1 && testEl[0].style[properties[4]] != undefined){
4606			testEl.attr('id','ls-test3d').appendTo( el );
4607            s3d1 = testEl[0].offsetHeight === 3 && testEl[0].offsetLeft === 9;
4608			testEl.remove();
4609        }
4610
4611        return (s3d1 && s3d2);
4612	};
4613
4614	// Order array function
4615
4616	var lsOrderArray = function(x,y,dir) {
4617		var i = [];
4618		if(dir=='forward'){
4619			for( var a=0; a<x;a++){
4620				for( var b=0; b<y; b++){
4621					i.push(a+b*x);
4622				}
4623			}
4624		}else{
4625			for( var a=x-1; a>-1;a--){
4626				for( var b=y-1; b>-1; b--){
4627					i.push(a+b*x);
4628				}
4629			}
4630		}
4631		return i;
4632	};
4633
4634	// CountProp counts the properties in an object
4635
4636	var lsCountProp = function(obj) {
4637	    var count = 0;
4638
4639	    for(var prop in obj) {
4640	        if(obj.hasOwnProperty(prop)){
4641	            ++count;
4642			}
4643	    }
4644	    return count;
4645	};
4646
4647	// We need the browser function (removed from jQuery 1.9)
4648
4649	var lsBrowser = function(){
4650
4651		uaMatch = function( ua ) {
4652			ua = ua.toLowerCase();
4653
4654			var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
4655				/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
4656				/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
4657				/(msie) ([\w.]+)/.exec( ua ) ||
4658				ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
4659				[];
4660
4661			return {
4662				browser: match[ 1 ] || "",
4663				version: match[ 2 ] || "0"
4664			};
4665		};
4666
4667		var matched = uaMatch( navigator.userAgent ), browser = {};
4668
4669		if ( matched.browser ) {
4670			browser[ matched.browser ] = true;
4671			browser.version = matched.version;
4672		}
4673
4674		if ( browser.chrome ) {
4675			browser.webkit = true;
4676		} else if ( browser.webkit ) {
4677			browser.safari = true;
4678		}
4679
4680		return browser;
4681	};
4682
4683	lsPrefixes = function(obj, method){
4684
4685		var pfx = ['webkit', 'khtml', 'moz', 'ms', 'o', ''];
4686		var p = 0, m, t;
4687		while (p < pfx.length && !obj[m]) {
4688			m = method;
4689			if (pfx[p] == '') {
4690				m = m.substr(0,1).toLowerCase() + m.substr(1);
4691			}
4692			m = pfx[p] + m;
4693			t = typeof obj[m];
4694			if (t != 'undefined') {
4695				pfx = [pfx[p]];
4696				return (t == 'function' ? obj[m]() : obj[m]);
4697			}
4698			p++;
4699		}
4700	};
4701
4702	// Global parameters (Do not change these settings!)
4703
4704	layerSlider.global = {
4705
4706		version				: '5.1.0',
4707
4708		isMobile			: function(){
4709								if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i) ){
4710									return true;
4711								}else{
4712									return false;
4713								}
4714							},
4715		isHideOn3D			: function(el){
4716								if( el.css('padding-bottom') == 'auto' || el.css('padding-bottom') == 'none' || el.css('padding-bottom') == 0 || el.css('padding-bottom') == '0px' ){
4717									return true;
4718								}else{
4719									return false;
4720								}
4721							},
4722
4723		// NEW FEATURE 4.0 CSS3 transitions
4724		//				   (beta, currently animating only the new 2D and 3D layer tranisitons with CSS3)
4725		//				   (2D layer transitions are working also with jQuery fallback mode)
4726
4727//		cssTransitions		: !lsBrowser().msie || ( lsBrowser().msie && lsBrowser().version > 9 ) ? true : false,
4728		ie78				: lsBrowser().msie && lsBrowser().version < 9 ? true : false,
4729		paused				: false,
4730		pausedByVideo		: false,
4731		autoSlideshow		: false,
4732		isAnimating			: false,
4733		layersNum			: null,
4734		prevNext			: 'next',
4735		slideTimer			: null,
4736		sliderWidth			: null,
4737		sliderHeight		: null,
4738		slideDirections		: {
4739								prev : {
4740									left	: 'right',
4741									right	: 'left',
4742									top		: 'bottom',
4743									bottom	: 'top'
4744								},
4745								next : {
4746									left	: 'left',
4747									right	: 'right',
4748									top		: 'top',
4749									bottom	: 'bottom'
4750								}
4751							},
4752
4753		// Default delay time, fadeout and fadein durations of videoPreview images
4754
4755		v					: {
4756								d	: 500,
4757								fo	: 750,
4758								fi	: 500
4759							}
4760	};
4761
4762	// Layer Transition Defaults
4763
4764	layerSlider.layerTransitions = {
4765
4766		offsetXIn			: 80,
4767		offsetYIn			: 0,
4768		durationIn			: 1000,
4769		delayIn				: 0,
4770		easingIn			: 'easeInOutQuint',
4771		fadeIn				: true,
4772		rotateIn			: 0,
4773		rotateXIn			: 0,
4774		rotateYIn			: 0,
4775		scaleIn				: 1,
4776		scaleXIn			: 1,
4777		scaleYIn			: 1,
4778		skewXIn				: 0,
4779		skewYIn				: 0,
4780		transformOriginIn	: ['50%','50%','0'],
4781		perspectiveIn 		: 500,
4782
4783		offsetXOut			: -80,
4784		offsetYOut			: 0,
4785		durationOut			: 400,
4786		showUntil			: 0,
4787		easingOut			: 'easeInOutQuint',
4788		fadeOut				: true,
4789		rotateOut			: 0,
4790		rotateXOut			: 0,
4791		rotateYOut			: 0,
4792		scaleOut			: 1,
4793		scaleXOut			: 1,
4794		scaleYOut			: 1,
4795		skewXOut			: 0,
4796		skewYOut			: 0,
4797		transformOriginOut	: ['50%','50%','0'],
4798		perspectiveOut 		: 500
4799	};
4800
4801	layerSlider.slideTransitions = {
4802
4803		slideDelay			: 4000							// Time before the next slide will be loading.
4804	};
4805
4806	// Global settings (can be modified)
4807
4808	layerSlider.options = {
4809
4810		// Layout
4811
4812		responsive			: true,
4813		responsiveUnder		: 0,
4814		layersContainer		: 0,
4815
4816		// Slideshow
4817
4818		autoStart			: true,
4819		pauseOnHover		: true,
4820		firstSlide			: 1,
4821		animateFirstSlide	: true,
4822		loops				: 0,
4823		forceLoopNum		: true,
4824		twoWaySlideshow		: false,
4825		randomSlideshow		: false,
4826
4827		// Appearance
4828
4829		skin				: 'v5',
4830		skinsPath			: '/layerslider/skins/',
4831		globalBGColor		: 'transparent',
4832		globalBGImage		: false,
4833
4834		// Navigation Area
4835
4836		navPrevNext			: true,
4837		navStartStop		: true,
4838		navButtons			: true,
4839		keybNav				: true,
4840		touchNav			: true,
4841		hoverPrevNext		: true,
4842		hoverBottomNav		: false,
4843		showBarTimer		: false,
4844		showCircleTimer		: true,
4845
4846		// Thumbnail navigation
4847
4848		thumbnailNavigation	: 'hover',
4849		tnContainerWidth	: '60%',
4850		tnWidth				: 100,
4851		tnHeight			: 60,
4852		tnActiveOpacity		: 35,
4853		tnInactiveOpacity	: 100,
4854
4855		// Videos
4856
4857		autoPlayVideos		: true,
4858		autoPauseSlideshow	: 'auto',
4859		youtubePreview		: 'maxresdefault.jpg',
4860
4861		// Preload
4862
4863		imgPreload			: true,
4864		lazyLoad 			: true,
4865
4866		// YourLogo
4867
4868		yourLogo			: false,
4869		yourLogoStyle		: 'left: -10px; top: -10px;',
4870		yourLogoLink		: false,
4871		yourLogoTarget		: '_self',
4872
4873		// Optimize for IE7 and IE8
4874
4875		optimizeForMobile	: true,
4876		optimizeForIE78		: true,
4877
4878		// API functions
4879
4880		cbInit				: function(element){},
4881		cbStart				: function(data){},
4882		cbStop				: function(data){},
4883		cbPause				: function(data){},
4884		cbAnimStart			: function(data){},
4885		cbAnimStop			: function(data){},
4886		cbPrev				: function(data){},
4887		cbNext				: function(data){},
4888
4889		// !!! IMPORTANT !!! The following properties are deprecated from version 5.0.0 DO NOT USE THEM.
4890		// The slider will recognize these properties in the init code or if you add these properties into the style attribute of the layer
4891		// but we recommend you to use to new html5 data attribute (data-ls) with the new properties
4892
4893		slideDelay			: 4000,
4894		slideDirection		: 'right',
4895		parallaxIn			: .45,
4896		parallaxOut			: .45,
4897		durationIn			: 1000,
4898		durationOut			: 1000,
4899		easingIn			: 'easeInOutQuint',
4900		easingOut			: 'easeInOutQuint',
4901		delayIn				: 0,
4902		delayOut			: 0
4903	};
4904
4905})(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.