PageSourceSearch

https://www.collegefortn.org/wp-content/plugins/goodlayers-core/include/js/page-builder.js?ver=1.3.9

js collegefortn.org collected 2026-09-24 09:48:50 UTC 102,679 bytes, 3,094 lines download raw bytes

1/* start page builder */
2(function($){
3	"use strict";
4
5	// Detect Mobile Device
6	var gdlr_core_mobile = false;
7	if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/BlackBerry/i) ||
8		navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/Windows Phone/i) ){ 
9		gdlr_core_mobile = true; 
10	}else{ 
11		gdlr_core_mobile = false; 
12	}
13
14	// Detect Screen
15	var gdlr_core_display = 'desktop';
16	if( typeof(window.matchMedia) == 'function' ){
17		$(window).on('resize themename-set-display gdlr-core-element-resize', function(){
18			if( window.matchMedia('(max-width: 419px)').matches ){
19				gdlr_core_display = 'mobile-portrait';
20			}else if( window.matchMedia('(max-width: 767px)').matches ){
21				gdlr_core_display = 'mobile-landscape'
22			}else if( window.matchMedia('(max-width: 959px)').matches ){
23				gdlr_core_display = 'tablet'
24			}else{
25				gdlr_core_display = 'desktop';
26			}
27		});
28		$(window).trigger('themename-set-display');
29	}else{
30		$(window).on('resize themename-set-display gdlr-core-element-resize', function(){
31			if( $(window).innerWidth() <= 419 ){
32				gdlr_core_display = 'mobile-portrait';
33			}else if( $(window).innerWidth() <= 767 ){
34				gdlr_core_display = 'mobile-landscape'
35			}else if( $(window).innerWidth() <= 959 ){
36				gdlr_core_display = 'tablet'
37			}else{
38				gdlr_core_display = 'desktop';
39			}
40		});
41		$(window).trigger('themename-set-display');
42	}
43	
44	// set cookie
45	function gdlr_core_set_cookie( cname, cvalue, expires ){
46		if( typeof(expires) != 'undefined' ){
47			if( expires == 0 ){
48				expires = 86400;
49			}
50
51			var now = new Date();
52			var new_time  = now.getTime() + (parseInt(expires) * 1000);
53			now.setTime(new_time);
54
55			expires = now.toGMTString();
56		}
57
58	    document.cookie = cname + "=" + encodeURIComponent(cvalue) + "; expires=" + expires + "; path=/";
59	}
60
61	// monitor swipe
62	$.fn.gdlr_core_monitor_swipe = function (settings) {
63
64		// default parameter
65		settings = $.extend(
66			{
67				mouseEvent: true,
68				swipeThreshold: 150,
69				allowedTime: 300
70			},
71			settings
72		);
73
74		var swipeArea  = $( this );
75		var startX     = 0, startTime = 0;
76		var startEvent = settings.mouseEvent ? 'mousedown touchstart' : 'touchstart';
77		var endEvent   = settings.mouseEvent ? 'mouseup touchend' : 'touchend';
78
79		swipeArea.on(
80			startEvent,
81			function (e) {
82				startX    = e.clientX;
83				startTime = new Date().getTime();
84			}
85		);
86		swipeArea.on(
87			endEvent,
88			function (e) {
89
90				var swipeDistance = e.clientX - startX;
91				var elapsedTime   = new Date().getTime() - startTime;
92
93				if (elapsedTime <= settings.allowedTime && Math.abs( swipeDistance ) > settings.swipeThreshold ) {
94					if (swipeDistance > 0 ) {
95						swipeArea.trigger( 'swiperight' );
96					} else {
97						swipeArea.trigger( 'swipeleft' );
98					}
99				}
100			}
101		);
102
103		// prevent dragitem
104		if (settings.mouseEvent ) {
105			swipeArea.on(
106				'dragstart',
107				function (e) {
108					e.preventDefault();
109				}
110			);
111		}
112
113	}
114
115	// script for normal content
116	$.fn.gdlr_core_content_script = function( filter_elem, document_ready ){
117
118		$(this).gdlr_core_fluid_video( filter_elem );
119
120		// audio
121		if( !document_ready && typeof($.fn.mediaelementplayer) == 'function' ){
122			var wpme_settings = {
123				"stretching": "responsive"
124			};
125			if( typeof(_wpmejsSettings) !== 'undefined' ){ 
126				wpme_settings.pluginPath = _wpmejsSettings.pluginPath; 
127			}
128
129			$(this).find('audio, video').mediaelementplayer(wpme_settings);
130		}		
131
132		return $(this);
133	}
134
135	// responsive video
136	$.fn.gdlr_core_fluid_video = function( filter_elem ){
137		
138		if( typeof(filter_elem) == 'undefined' ){
139			var elem = $(this).find('iframe[src*="youtube"], iframe[src*="vimeo"]');
140		}else{
141			var elem = filter_elem.filter('iframe[src*="youtube"], iframe[src*="vimeo"]');
142		}
143		
144		elem.each(function(){
145
146			// ignore if inside slider
147			if( $(this).closest('.ls-container, .master-slider').length <= 0 ){ 
148				if( ($(this).is('embed') && $(this).parent('object').length) || $(this).parent('.gdlr-core-fluid-v
148ideo-wrapper').length ){ return; } 
149				if( !$(this).attr('id') ){ $(this).attr('id', 'gdlr-video-' + Math.floor(Math.random()*999999)); }			
150			
151				if( $(this).attr('height') && $(this).attr('width') ){
152					var ratio = parseInt($(this).attr('height')) / parseInt($(this).attr('width'));
153				}else{
154					var ratio = $(this).height() / $(this).width();
155				}
156				$(this).removeAttr('height').removeAttr('width');
157				
158				try{
159					$(this).wrap('<div class="gdlr-core-fluid-video-wrapper"></div>').parent().css('padding-top', (ratio * 100)+"%");
160					$(this).attr('src', $(this).attr('src'));
161				}catch(e){}
162			}
163		});	
164
165		// overlay
166		$('.gdlr-core-video-item-overlay').each(function(){
167
168			var button = $(this);
169			var video = $(this).closest('.gdlr-core-video-item').find('iframe');
170
171			// vimeo
172			if( video.attr('data-player-type') == 'vimeo' ){
173
174				var player = $f(video[0]);
175							
176				button.on('click', function(){
177					$(this).css('pointer-events', 'none').fadeOut(500, function(e){
178						$(this).remove();
179					});
180
181					video[0].src += "&autoplay=1";
182				});
183			
184			}else if( video.attr('data-player-type') == 'youtube' ){
185
186				button.on('click', function(){
187					$(this).css('pointer-events', 'none').fadeOut(500, function(e){
188						$(this).remove();
189					});
190
191					video[0].src += "&autoplay=1&mute=1";
192				});	
193
194			}
195		});			
196
197		return $(this);
198	}
199
200	// ajax mejs
201	$.fn.gdlr_core_mejs_ajax = function(){
202		if( typeof($.fn.mediaelementplayer) == 'function' ){
203
204			var wpme_settings = {};
205			if( typeof(_wpmejsSettings) !== 'undefined' ){ wpme_settings.pluginPath = _wpmejsSettings.pluginPath; }
206			$(this).find('audio, video').mediaelementplayer(wpme_settings);
207
208		}
209	}
210
211	// hover box
212	$.fn.gdlr_core_hover_box = function( filter_elem ){
213
214		if( typeof(filter_elem) == 'undefined' ){
215			var elem = $(this).find('.gdlr-core-hover-box .gdlr-core-hover-thumbnail');
216		}else{
217			var elem = filter_elem.filter('.gdlr-core-hover-box').find('.gdlr-core-hover-thumbnail');
218		}
219
220
221		elem.each(function(){
222			$(this).closest('.gdlr-core-hover-box').hover(function(){
223				var ch1 = $(this).find('.gdlr-core-hover-thumbnail').children('img').eq(0);
224				var ch2 = $(this).find('.gdlr-core-hover-thumbnail').children('img').eq(1);
225
226				ch1.css('display', 'none');
227				ch2.fadeIn(300);
228			}, function(){
229				var ch1 = $(this).find('.gdlr-core-hover-thumbnail').children('img').eq(0);
230				var ch2 = $(this).find('.gdlr-core-hover-thumbnail').children('img').eq(1);
231
232				ch2.css('display', 'none');
233				ch1.fadeIn(300);
234			});
235		});
236
237	}
238
239	// counter item
240	$.fn.gdlr_core_counter_item = function( filter_elem ){
241		
242		if( typeof(filter_elem) == 'undefined' ){
243			var elem = $(this).find('.gdlr-core-counter-item-count[data-counter-start][data-counter-end]');
244		}else{
245			var elem = filter_elem.filter('.gdlr-core-counter-item-count[data-counter-start][data-counter-end]');
246		}
247		
248		elem.each(function(){
249			var counter_item = $(this);
250			var start_num = parseFloat($(this).attr('data-counter-start'));
251			var end_num = parseFloat($(this).attr('data-counter-end'));
252			var duration_time = ($(this).attr('data-duration'))? parseInt($(this).attr('data-duration')): 4000;
253
254			var decimal = 0;
255			if( $(this).attr('data-counter-end') ){
256				var decimalArray = $(this).attr('data-counter-end').split('.');
257				if( decimalArray[1] ){
258					decimal = decimalArray[1].length;
259				}
260			}
261			
262			if( (gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') || $(window).scrollTop() + $(window).height() > counter_item.offset().top ){
263				$({ counter_num: start_num * (10 ** decimal) }).animate({ counter_num: end_num * (10 ** decimal) }, { duration: duration_time, easing: 'easeOutExpo', 
264					step: function(){
265						if( this.counter_num > 0.3 ){
266							counter_item.html( Math.round(this.counter_num) / (10 ** decimal) );
267						}else{
268							counter_item.html( 0 );
269						}
270						
271					}
272				});
273				console.log(decimal, (10 ** decimal));
274			}else{
275				$(window).on('scroll pb-scroll', function( e ){
276					if( $(this).scrollTop() + $(window).height() > counter_item.offset().top ){
277						$({ counter_num: start_num * (10 ** decimal) }).animate({ counter_num: end_num * (10 ** decimal) }, { duration: duration_time,  easing: 'easeOutQuart', 
278							step: function(){
279								if( this.counter_num > 0.3 ){
280									counter_item.html( Math.ceil(this.counter_num) / (10 ** decimal) );
281								}else{
282									counter_item.html( 0 );
283								}
284							}
285						});
286						console.log((10 ^ decimal));
287						
288						$(this).unbind('scroll pb-scroll', e.handleObj.handler, e);
289					}
290				});
291			}
292		});
293	}
294
295	// typed animation item
296	$.fn.gdlr_core_typed_animation = function( filter_elem ){
297		
298		if( typeof(filter_elem) == 'undefined' ){
299			var elem = $(this).find('.gdlr-core-type-animation-item-animated[data-animation-text]');
300		}else{
301			var elem = filter_elem.filter('.gdlr-core-type-animation-item-animated[data-animation-text]');
302		}
303		
304		elem.each(function(){
305
306			var animation_text = JSON.parse($(this).attr('data-animation-text'));
307			
308			if( typeof($.fn.typed) == 'function' && animation_text && animation_text.length > 0 ){
309				$(this).typed({
310					strings: animation_text,
311					typeSpeed: 50,
312					loop: true
313				});
314			}
315		});
316	}
317
318	// countdown item
319	$.fn.gdlr_core_countdown_item = function( filter_elem ){
320		
321		if( typeof(filter_elem) == 'undefined' ){
322			var elem = $(this).find('.gdlr-core-countdown-wrap');
323		}else{
324			var elem = filter_elem.filter('.gdlr-core-countdown-wrap');
325		}
326		
327		elem.each(function(){
328			var day_field = $(this).find('.gdlr-core-day');
329			var day = parseInt(day_field.text());
330			
331			var hrs_field = $(this).find('.gdlr-core-hrs');
332			var hrs = parseInt(hrs_field.text());
333			
334			var min_field = $(this).find('.gdlr-core-min');
335			var min = parseInt(min_field.text());
336			
337			var sec_field = $(this).find('.gdlr-core-sec');
338			var sec = parseInt(sec_field.text());
339			
340			$(window).on('load', function(){
341				sec_field.text('00');
342				sec_field.css('width', sec_field.width());
343				sec_field.text(sec);
344			});
345
346			var i = setInterval(function(){
347				if( sec > 0 ){
348					sec--;			
349				}else{
350					sec = 59;
351					if( min > 0 ){
352						min--;
353					}else{
354						min = 59;
355						if( hrs > 0 ){
356							hrs--;
357						}else{
358							hrs = 24;
359							if( day > 0 ){
360								day--;
361							}else{
362								day = 0;
363								hrs = 0;
364								min = 0;
365								sec = 0;
366								clearInterval(i);
367							}
368							day_field.text(day);
369						}
370						hrs_field.text(hrs);
371					}
372					min_field.text(min);
373				}
374				sec_field.text(sec);	
375			}, 1000);
376		});
377	}
378
379	// accordion
380	$.fn.gdlr_core_accordion = function( filter_elem ){
381	
382		if( typeof(filter_elem) == 'undefined' ){
383			var elem_title = $(this).find('.gdlr-core-accordion-item-title');
384			var elem_icon = $(this).find('.gdlr-core-accordion-item-icon');
385		}else{
386			var elem_title = filter_elem.filter('.gdlr-core-accordion-item-title');
387			var elem_icon = filter_elem.filter('.gdlr-core-accordion-item-icon');
388		}	
389		
390		elem_title.click(function(){
391			$(this).siblings('.gdlr-core-accordion-item-content').slideDown(200);
392			
393			var item_tab = $(this).closest('.gdlr-core-accordion-item-tab');
394			if( item_tab.hasClass('gdlr-core-active') ){
395				if( item_tab.closest('.gdlr-core-accordion-item').hasClass('gdlr-core-allow-close-all') ){
396					item_tab.removeClass('gdlr-core-active')
397						.find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200);
398				}
399			}else{
400				item_tab.addClass('gdlr-core-active')
401					.siblings('.gdlr-core-active').removeClass('gdlr-core-active')
402					.find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200);
403			}
404		});
405		elem_icon.click(function(){
406			if( $(this).closest('.gdlr-core-accordion-item-title').length ){ return; }
407
408			$(this).siblings('.gdlr-core-accordion-item-content-wrapper').children('.gdlr-core-accordion-item-content').slideDown(200);
409			
410			var item_tab = $(this).closest('.gdlr-core-accordion-item-tab');
411			if( item_tab.hasClass('gdlr-core-active') ){
412				if( item_tab.closest('.gdlr-core-accordion-item').hasClass('gdlr-core-allow-close-all') ){
413					item_tab.removeClass('gdlr-core-active')
414						.find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200);
415				}
416			}else{
417				item_tab.addClass('gdlr-core-active')
418					.siblings('.gdlr-core-active').removeClass('gdlr-core-active')
419					.find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200);
420			}
421		});
422	}
423
424	// toggle_box
425	$.fn.gdlr_core_toggle_box = function( filter_elem ){
426		
427		if( typeof(filter_elem) == 'undefined' ){
428			var elem_title = $(this).find('.gdlr-core-toggle-box-item-title');
429			var elem_icon = $(this).find('.gdlr-core-toggle-box-item-icon');
430		}else{
431			var elem_title = filter_elem.filter('.gdlr-core-toggle-box-item-title');
432			var elem_icon = filter_elem.filter('.gdlr-core-toggle-box-item-icon');
433		}		
434		
435		elem_title.click(function(){
436			var toggle_parent = $(this).closest('.gdlr-core-toggle-box-item-tab');
437			if( toggle_parent.hasClass('gdlr-core-active') ){
438				
439				toggle_parent.removeClass('gdlr-core-active');
440				$(this).siblings('.gdlr-core-toggle-box-item-content').css({display: 'block'}).slideUp(200);
441				
442			}else{
443
444				toggle_parent.addClass('gdlr-core-active');
445				$(this).siblings('.gdlr-core-toggle-box-item-content').css({display: 'none'}).slideDown(200);
446			}
447		});
448		elem_icon.click(function(){
449			if( $(this).closest('.gdlr-core-toggle-box-item-title').length ){ return; }
450			
451			var toggle_parent = $(this).closest('.gdlr-core-toggle-box-item-tab');
452			if( toggle_parent.hasClass('gdlr-core-active') ){
453				toggle_parent.removeClass('gdlr-core-active');
454				$(this).siblings('.gdlr-core-toggle-box-item-content-wrapper').children('.gdlr-core-toggle-box-item-content').css({display: 'block'}).slideUp(200);
455				
456			}else{
457				toggle_parent.addClass('gdlr-core-active');
458				$(this).siblings('.gdlr-core-toggle-box-item-content-wrapper').children('.gdlr-core-toggle-box-item-content').css({display: 'none'}).slideDown(200);
459			}
460		});
461	}	
462
463	// alert box
464	$.fn.gdlr_core_alert_box_item = function( filter_elem ){
465		
466		if( typeof(filter_elem) == 'undefined' ){
467			var elem = $(this).find('.gdlr-core-alert-box-remove');
468		}else{
469			var elem = filter_elem.filter('.gdlr-core-alert-box-remove');
470		}
471		
472		elem.click(function(){ 
473			$(this).closest('.gdlr-core-alert-box-item').slideUp(400, 'easeOutQuart', function(){
474				$(this).remove();
475			});
476		});
477	}
478
479	// particle background
480	$.fn.gdlr_core_particle_background = function( filter_elem ){
481
482		if( typeof(filter_elem) == 'undefined' ){
483			var elem = $(this).find('.gdlr-core-particle-bg');
484		}else{
485			var elem = filter_elem.filter('.gdlr-core-particle-bg');
486		}	
487
488		elem.each(function(){
489			if( typeof(window.gdlr_particle_bg_id) == 'undefined' ){
490				window.gdlr_particle_bg_id = 1;
491			}else{
492				window.gdlr_particle_bg_id++;
493			}
494
495			var item_id = 'gdlr-core-particle' + window.gdlr_particle_bg_id;
496			$(this).attr('id', item_id);
497
498			particlesJS(item_id, {
499			  "particles": {
500			    "number": {
501			      "value": 40,
502			      "density": {"enable": true,"value_area": 1500}
503			    },
504			    "color": {"value": "#ffffff"},
505			    "shape": {
506			      "type": "circle",
507			      "stroke": {"width": 0,"color": "#000000"},
508			      "polygon": {"nb_sides": 5},
509			      "image": {"src": "img/github.svg","width": 100,"height": 100}
510			    },
511			    "opacity": {
512			      "value": 0.8,
513			      "random": false,
514			      "anim": {"enable": false,"speed": 0.6,"opacity_min": 0.1,"sync": false}
515			    },
516			    "size": {
517			      "value": 2,
518			      "random": true,
519			      "anim": {"enable": false,"speed": 80,"size_min": 0.1,"sync": false}
520			    },
521			    "line_linked": {"enable": true,"distance": 300,"color": "#ffffff","opacity": 0.4,"width": 2},
522			    "move": {
523			      "enable": true,
524			      "speed": 12,
525			      "direction": "none",
526			      "random": false,
527			      "straight": false,
528			      "out_mode": "out",
529			      "bounce": false,
530			      "attract": {"enable": false,"rotateX": 600,"rotateY": 1200}
531			    }
532			  },
533			  "interactivity": {
534			    "detect_on": "canvas",
535			    "events": {
536			      "onhover": {"enable": false,"mode": "repulse"},
537			      "onclick": {"enable": false,"mode": "push"},
538			      "resize": true
539			    },
540			    "modes": {
541			      "grab": {"distance": 800,"line_linked": {"opacity": 1}},
542			      "bubble": {"distance": 800,"size": 80,"duration": 2,"opacity": 0.8,"
542speed": 3},
543			      "repulse": {"distance": 400,"duration": 0.4},
544			      "push": {"particles_nb": 4},
545			      "remove": {"particles_nb": 2}
546			    }
547			  },
548			  "retina_detect": true
549			});
550		});
551
552		return $(this);
553	}
554
555	// parallax background
556	$.fn.gdlr_core_parallax_background = function( filter_elem ){
557
558		if( typeof(filter_elem) == 'undefined' ){
559			var elem = $(this).find('.gdlr-core-parallax');
560		}else{
561			var elem = filter_elem.filter('.gdlr-core-parallax');
562		}	
563		
564		elem.each(function(){ 
565			new gdlr_core_parallax($(this)); 
566		});
567
568		return $(this);
569	}
570	
571	var gdlr_core_parallax = function(t){
572		
573		this.wrapper_bg = t;
574		this.wrapper = t.parent(); // background-wrap
575		
576		this.parallax_speed = parseFloat(t.attr('data-parallax-speed'));
577
578		this.init();
579	}
580	gdlr_core_parallax.prototype = {
581		
582		init: function(){
583			
584			var t = this;
585
586			// scroll event
587			if( t.parallax_speed != 0 ){
588				t.set_extra_height();
589				t.set_background_position(t);
590				$(window).on('load resize gdlr-core-element-resize', function(){ 
591					t.set_extra_height($(this)); 
592					t.set_background_position(t);
593				});
594
595				$(window).on('scroll pb-scroll', function(){ 
596					t.set_background_position(t);
597				});
598			}
599			
600			if( gdlr_core_mobile ){
601				t.wrapper_bg.children('[data-background-type="video"]').remove();
602				
603				if( t.wrapper_bg.attr('data-video-fallback') ){
604					t.wrapper_bg.css('background-image', 'url(' + t.wrapper_bg.attr('data-video-fallback') + ')')
605				}
606			}else{
607				t.wrapper_bg.children('[data-background-type="video"]').each(function(){
608					if( t.parallax_speed == 0 ){
609						t.set_extra_height();
610						t.set_background_position(t);
611						$(window).on('load resize gdlr-core-element-resize', function(){ 
612							t.set_extra_height($(this)); 
613							t.set_background_position(t);
614						});
615					}
616
617					// script for muting the vimeo/youtube player
618					$(this).find('iframe').each(function(){
619						if( $(this).attr('data-player-type') == 'vimeo' ){
620							var player = $f($(this)[0]);
621							
622							player.addEvent('ready', function() {
623								player.api('setVolume', 0);
624							});
625						}else if( $(this).attr('data-player-type') == 'youtube' ){
626
627							// assign the script
628							if( $('body').children('#gdlr-core-youtube-api').length == 0 ){
629								$('body').append('<script src="https://www.youtube.com/iframe_api" id="gdlr-core-youtube-api" ></script>');
630							}
631							
632							// store to global variable
633							if( typeof(window.gdlr_core_ytb) == 'undefined' ){
634								window.gdlr_core_ytb = [$(this)[0]];
635							}else{
636								window.gdlr_core_ytb.push($(this)[0]);
637							}
638
639							// script loading action
640							window.onYouTubeIframeAPIReady = function(){
641
642								if( typeof(gdlr_core_ytb) != 'undefined' ){
643									for( var key in window.gdlr_core_ytb ){
644										new YT.Player(gdlr_core_ytb[key],{
645											events: { 
646												'onReady': function(e){
647													e.target.mute();
648													e.target.playVideo();
649												}
650											}						
651										});
652									}
653								}
654							}
655						}
656					});
657				});
658			} // else gdlr_core_mobile
659			
660		}, // init
661		
662		set_extra_height: function(){
663			
664			var t = this;
665			
666			var new_height = t.wrapper.outerHeight();
667			if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ){
668				t.wrapper_bg.css({'transform': ''});
669			}else{
670				if( t.parallax_speed > 0){
671					new_height += (($(window).height() - t.wrapper.outerHeight()) * t.parallax_speed);
672				}else if( t.parallax_speed < 0){
673					new_height += (($(window).height() + t.wrapper.outerHeight()) * Math.abs(t.parallax_speed));
674				}
675			}
676			t.wrapper_bg.css({height: new_height});
677			
678			// set video height
679			var ratio = parseInt(gdlr_core_pbf.video.width) / parseInt(gdlr_core_pbf.video.height);
680			t.wrapper_bg.children('[data-background-type="video"]').each(function(){
681				if( (t.wrapper_bg.width() / t.wrapper_bg.height()) > ratio ){
682					var v_height = t.wrapper_bg.width() / ratio;
683					var v_margin = (t.wrapper_bg.height() - v_height) / 2;
684					$(this).css({width: t.wrapper_bg.width(), height: v_height, 'margin-left': 0, 'margin-top': v_margin});
685				}else{
686					var v_width = t.wrapper_bg.height() * ratio;
687					var v_margin = (t.wrapper_bg.width() - v_width) / 2;
688					$(this).css({width: v_width, height: t.wrapper_bg.height(), 'margin-left': v_margin, 'margin-top': 0});
689				}
690			});
691			
692		}, // set_extra_height
693		
694		set_background_position: function( t ){
695
696			if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ) return;
697			
698			var wrapper_top = t.wrapper.offset().top;
699			var scroll_pos = $(window).scrollTop();
700
701			if( scroll_pos + $(window).height() > wrapper_top && 
702				scroll_pos < wrapper_top + t.wrapper.outerHeight() ){
703				
704				if( t.parallax_speed > 0 ){
705					t.wrapper_bg.css({'transform': 'translate(0px, ' + (($(window).scrollTop() - wrapper_top) * t.parallax_speed) + 'px)'});
706				}else if( t.parallax_speed < 0 ){
707					t.wrapper_bg.css({'transform': 'translate(0px, ' + (($(window).scrollTop() + $(window).height() - wrapper_top) * t.parallax_speed) + 'px)'});
708				}
709			}
710		}
711	}; // gdlr_core_parallax
712	
713	// ux animation
714	var gdlr_core_ux = function( container, filter_elem ){
715		
716		if( typeof(filter_elem) == 'undefined' ){
717			this.elem = container.find('[data-gdlr-animation]');
718		}else{
719			this.elem = filter_elem.filter('[data-gdlr-animation]');
720			this.preload = filter_elem.filter('.gdlr-core-page-preload');
721		}
722		
723		this.ux_items = [];
724		this.ux_item_length = 0;
725		
726		this.init();
727
728		// for 3d effects
729		if( !gdlr_core_mobile && gdlr_core_display == 'desktop' ){
730			if( typeof(filter_elem) == 'undefined' ){
731				var elem_3d = container.find('.gdlr-core-effect-3d');
732			}else{
733				var elem_3d = filter_elem.filter('.gdlr-core-effect-3d');
734			}
735			
736			elem_3d.each(function(){
737				var plain = $(this);
738				var max_degree = $(this).attr('data-max-deg');
739				if( max_degree == null ){
740					max_degree = 30;
741				}
742
743				$(this).parent().on('mousemove', function(e){
744					if( !gdlr_core_display == 'desktop' ) return;
745
746					var posX = e.pageX - $(this).offset().left;
747					var posY = e.pageY - $(this).offset().top;
748					var half_width = $(this).outerWidth()/2;
749					var half_height = $(this).outerHeight()/2;
750					var ax = max_degree * -(half_width - posX) / half_width;
751	  				var ay = max_degree * (half_height - posY) / half_height;
752	  				
753	  				plain.removeClass('gdlr-core-animate-transform');
754	  				plain.css({'transform': 'rotateY(' + ax + 'deg) rotateX(' + ay + 'deg)'});
755				});
756				$(this).parent().on('mouseleave', function(e){
757					plain.addClass('gdlr-core-animate-transform');
758					plain.css({'transform': 'rotateY(0deg) rotateX(0deg)'});
759					setTimeout(function (){
760				        plain.removeClass('gdlr-core-animate-transform');
761				    }, 200);
762				});
763			});
764		}
765		
766	} // gdlr_core_ux
767	gdlr_core_ux.prototype = {
768		
769		init: function(){
770			
771			var t = this;
772			
773			t.ux_item_length = t.elem.each(function(){
774				var ux_item = $(this);
775				var ux_item_offset = 0.8;
776				if( $(this).attr('data-gdlr-animation-offset') ){
777					ux_item_offset = parseFloat($(this).attr('data-gdlr-animation-offset'));
778				}
779				
780				// check item at the first time the page is loaded
781				if( (gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') || $(window).scrollTop() + $(window).height() > ux_item.offset().top ){
782					t.ux_items.push(ux_item);
783					
784				// check the item on scroll event
785				}else{
786					$(window).on('scroll pb-scroll', function(e){
787						if( $(window).scrollTop() + ($(window).height() * ux_item_offset) > ux_item.offset().top ){
788							t.ux_items.push(ux_item);
789							$(window).unbind('scroll', e.handleObj.handler, e);
790						} 
791					});
792				}
793			}).length;
794			
795			/*
796			if( typeof(t.preload) != 'undefined' && t.preload.length ){
797				$(window).on('load', function(){
798					var preload_time = t.preload.attr('data-animation-time');
799					if( !preload_time ){ preload_time = 0; }
800					
801					setTimeout(function(){
802						t.animate();
803					}, preload_time);
804				});
805			}else{
806			*/
807				t.animate();
808			// }
809			
810		},
811		
812		animate: function(){
813			
814			var t = this;
815			
816			// run the ux in order with delay
817			var ux_interval = setInterval(function(){ 
818				
819				while( t.ux_items.length > 0 ){
820
821					// animate the ux item
822					var ux_animate = t.ux_items.shift();
823					var animation_duration = '600ms';
824					if( ux_animate.attr('data-gdlr-animation-duration') ){
825						animation_duration = ux_animate.attr('data-gdlr-animation-duration');
826					}
827
828					ux_animate.css({ 'animation-duration':  animation_duration });
829					ux_animate.addClass(ux_animate.attr('data-gdlr-animation'));
830					
831					// remove selector
832					setTimeout(function(){
833						ux_animate.css({ 'animation-duration':  '' })
834							.removeClass(ux_animate.attr('data-gdlr-animation'))
835							.removeAttr('data-gdlr-animation');
836					}, parseInt(animation_duration));	
837						
838					t.ux_item_length--;
839
840					// if item is inside the screen break while loop
841					if(	$(window).scrollTop() < ux_animate.offset().top + ux_animate.outerHeight() ){
842						break;
843					}
844				}
845				
846				if( t.ux_item_length <= 0 ){
847					clearInterval(ux_interval);
848				}
849			}, 200);
850			
851		}
852		
853	}; // gdlr_core_ux.prototype
854	$.fn.gdlr_core_ux = function( filter_elem ){
855		new gdlr_core_ux( $(this), filter_elem );
856		
857		return $(this);
858	}
859	
860	// skill bar
861	$.fn.gdlr_core_skill_bar = function( filter_elem ){
862
863		if( typeof(filter_elem) == 'undefined' ){
864			var elem = $(this).find('.gdlr-core-skill-bar-filled');
865		}else{
866			var elem = filter_elem.filter('.gdlr-core-skill-bar-filled');
867		}	
868		
869		elem.each(function(){
870			var t = $(this);
871			
872			if( (gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') || $(window).scrollTop() + $(window).height() > t.offset().top ){
873				t.animate({width: parseInt(t.attr('data-width')) + '%'}, {duration: 1200, easing: 'easeOutQuart'}).addClass('gdlr-core-animate');	
874			}else{
875				$(window).on('scroll pb-scroll', function(e){
876					if( $(window).scrollTop() + $(window).height() > t.offset().top ){
877						t.animate({width: parseInt(t.attr('data-width')) + '%'}, {duration: 1200, easing: 'easeOutQuart'}).addClass('gdlr-core-animate');
878						$(window).unbind('scroll pb-scroll', e.handleObj.handler, e);
879					} 
880				});
881			}
882		});
883	}
884	
885	// divider width
886	$.fn.gdlr_core_divider = function( filter_elem ){
887
888		if( typeof(filter_elem) == 'undefined' ){
889			var elem = $(this).find('.gdlr-core-divider-item-with-icon-inner');
890		}else{
891			var elem = filter_elem.filter('.gdlr-core-divider-item-with-icon-inner');
892		}
893	
894		elem.each(function(){
895			var divider_elem = $(this);
896			var icon_width = divider_elem.children('i, img').outerWidth();
897			var divider_width = (divider_elem.width() - icon_width) / 2;
898			$(this).children('.gdlr-core-divider-line').css({ width: divider_width }).each(function(){
899				$(this).css('margin-top', -$(this).outerHeight()/2);
900			});
901
902			$(window).on('resize gdlr-core-element-resize', function(){
903				icon_width = divider_elem.children('i, img').outerWidth();
904				divider_width = (divider_elem.width() - icon_width) / 2;
905				divider_elem.children('.gdlr-core-divider-line').css({ width: divider_width }).each(function(){
906					$(this).css('margin-top', -$(this).outerHeight()/2);
907				});
908			});
909		});
910		
911	}	
912
913	window.gdlr_core_sidebar_wrapper = function( container, filter_elem ){
914
915		if( typeof(filter_elem) == 'undefined' ){
916			this.elem = container.find('.gdlr-core-page-builder-wrapper-sidebar-container, .gdlr-core-pbf-sidebar-container');
917		}else{
918			this.elem = filter_elem.filter('.gdlr-core-page-builder-wrapper-sidebar-container, .gdlr-core-pbf-sidebar-container');
919		}
920
921		this.init();
922
923	}
924	gdlr_core_sidebar_wrapper.prototype = {
925
926		init: function(){
927
928			var t = this;
929
930			// if no background, don't sync height
931			var sync_height = false;
932			t.elem.each(function(){
933				if( $(this).children().children('.gdlr-core-pbf-background-wrap').length ){
934					sync_height = true;
935				}
936			});
937
938			// sync the height
939			if( sync_height ){
940				t.set_height();
941				$(window).on('load resize gdlr-core-element-resize', function(){ t.set_height(); });
942			}
943		},
944
945		set_height: function(){
946
947			var t = this;
948
949			t.elem.each(function(){
950
951				var sidebar_elem = $(this).find('.gdlr-core-pbf-sidebar-padding');
952				sidebar_elem.css('min-height', '');
953
954				if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ) return;
955				
956				// determine max height
957				var max_height = 0;
958				sidebar_elem.each(function(){
959					if( $(this).outerHeight() > max_height ){
960						max_height = $(this).outerHeight();
961					}
962				});
963
964				// set the height
965				sidebar_elem.css('min-height', max_height);
966
967			});
968			
969		}
970
971	};
972
973	// title divider width
974	$.fn.gdlr_core_title_divider = function( filter_elem ){
975
976		if( typeof(filter_elem) == 'undefined' ){
977			var elem = $(this).find('.gdlr-core-title-item-title-wrap.gdlr-core-with-divider');
978		}else{
979			var elem = filter_elem.filter('.gdlr-core-title-item-title-wrap.gdlr-core-with-divider');
980		}
981	
982		elem.each(function(){
983
984			var t = $(this);
985			var divider = t.children('.gdlr-core-title-item-divider');
986			var divider_num = t.children('.gdlr-core-title-item-divider').length;
987			divider_num = (divider_num)? divider_num: 1;
988			
989			var title_width = t.children('.gdlr-core-title-item-title').outerWidth(true);
990			var divider_width = (t.width() - title_width) / divider_num;
991			if( t.children('.gdlr-core-title-item-link').length ){
992				var right_pos = t.children('.gdlr-core-title-item-link').outerWidth() + 20;
993				divider_width = divider_width - right_pos;
994			}
995	
996			// for right divider with link text
997			if( t.children('.gdlr-core-title-item-link').length ){
998				divider.css({ width: divider_width, right: right_pos });
999			}else{
1000				divider.css({ width: divider_width });
1001			}
1002
1003			$(window).on('resize gdlr-core-element-resize', function(){
1004				title_width = t.children('.gdlr-core-title-item-title').outerWidth(true);
1005				divider_width = (t.width() - title_width) / divider_num;
1006				if( t.children('.gdlr-core-title-item-link').length ){
1007					right_pos = t.children('.gdlr-core-title-item-link').outerWidth() + 20;
1008					divider_width = divider_width - right_pos;
1009				}
1010
1011				// for right divider with link text
1012				if( t.children('.gdlr-core-title-item-link').length ){
1013					divider.css({ width: divider_width, right: right_pos });
1014				}else{
1015					divider.css({ width: divider_width });
1016				}
1017			});
1018		});
1019
1020		if( typeof(filter_elem) == 'undefined' ){
1021			var elem2 = $(this).find('.gdlr-core-title-item-title-wrap.gdlr-core-with-link-text');
1022		}else{
1023			var elem2 = filter_elem.filter('.gdlr-core-title-item-title-wrap.gdlr-core-with-link-text');
1024		}
1025		elem2.each(function(){
1026			var t = $(this);
1027			var title_width = t.children('.gdlr-core-title-item-title').outerWidth(true);
1028			var right_pos = t.children('.gdlr-core-title-item-link').outerWidth();
1029
1030			if( t.width() < title_width + right_pos ){
1031				t.children('.gdlr-core-title-item-link').addClass('gdlr-core-overflow');
1032			}else{
1033				t.children('.gdlr-core-title-item-link').removeClass('gdlr-core-overflow');
1034			}
1035
1036			$(window).on('resize gdlr-core-element-resize', function(){
1037				if( t.width() < title_width + right_pos ){
1038					t.children('.gdlr-core-title-item-link').addClass('gdlr-core-overflow');
1039				}else{
1040					t.children('.gdlr-core-title-item-link').removeClass('gdlr-core-overflow');
1041				}
1042			});
1043
1044		});
1045		
1046	}
1047
1048	$.fn.gdlr_core_flipbox = function( filter_elem ){
1049		if(typeof($.fn.flip) == 'function'){
1050			
1051			if( typeof(filter_elem) == 'undefined' ){
1052				var elem = $(this).find('.gdlr-core-flipbox');
1053			}else{
1054				var elem = filter_elem.filter('.gdlr-core-flipbox');
1055			}			
1056			
1057			elem.each(function(){
1058				var flipbox_obj = $(this).flip({
1059					axis: 'y',
1060					trigger: 'hover',
1061					autoSize: false,
1062					front: '.gdlr-core-flipbox-front',
1063					back: '.gdlr-core-flipbox-back'
1064				});
1065
1066				$(this).find('.gdlr-core-flipbox-back a').click(function(){
1067					if( flipbox_obj.data('flip-model') ){
1068						flipbox_obj.data('flip-model').unflip();
1069					}
1070				});
1071
1072				$(this).find('.gdlr-core-flipbox-back').on('touchstart', function(){
1073					$(this).closest('.gdlr-core-flipbox').data('flip-model').unflip();
1074				});
1075				$(this).find('.gdlr-core-flipbox-front').on('touchstart', function(){
1076					$(this).closest('.gdlr-core-flipbox').data('flip-model').flip();
1077				});
1078				
1079				$(this).addClass('gdlr-core-after-init');
1080			});
1081		}
1082
1083		return $(this);
1084	}
1085	
1086	// marquee
1087	$.fn.gdlr_core_marquee = function( filter_elem ){
1088		if( typeof(filter_elem) == 'undefined' ){
1089			var elem = $(this).find('.gdlr-core-marquee');
1090		}else{
1091			var elem = filter_elem.filter('.gdlr-core-marquee');
1092		}
1093
1094		elem.each(function(){
1095			var speed = $(this).attr('data-speed')? parseFloat($(this).attr('data-speed')): 10000;
1096			var direction = $(this).attr('data-direction')? parseFloat($(this).attr('data-direction')): 'left';
1097
1098			$(this).marquee({
1099				//time in milliseconds before the marquee will start animating
1100			    delayBeforeStart: 0,
1101			    //speed in milliseconds of the marquee
1102			    duration: speed,
1103			    //gap in pixels between the tickers
1104			    gap: 50,
1105			    //'left' or 'right'
1106			    direction: direction,
1107			    //true or false - should the marquee be duplicated to show an effect of continues flow
1108			    duplicated: true,
1109			    // the marquee is visible initially positioned next to the border towards it will be moving
1110			    startVisible: true
1111			});
1112		});
1113
1114		return $(this);
1115	}
1116
1117	// pie chart
1118	function gdlr_core_skill_circle_height(t){
1119		t.children('.gdlr-core-skill-circle-content').each(function(){
1120			$(this).css({'margin-top': -$(this).outerHeight()/2});
1121		});
1122		t.css({'max-width': t.parent().width(), 'max-height': t.parent().width()});	
1123	}
1124	$.fn.gdlr_core_pie_chart = function(){
1125		if(typeof($.fn.easyPieChart) == 'function'){
1126			$(this).easyPieChart({
1127				animate: parseInt($(this).attr('data-duration')),
1128				lineWidth: parseInt($(this).attr('data-line-width')),
1129				size: parseInt($(this).attr('data-width')),
1130				barColor: $(this).attr('data-filled-color'),
1131				trackColor: $(this).attr('data-filled-background'),
1132				scaleColor: false,
1133				lineCap: 'square'
1134			});
1135		}
1136	}
1137	$.fn.gdlr_core_skill_circle = function( filter_elem ){
1138		
1139		if( typeof(filter_elem) == 'undefined' ){
1140			var elem = $(this).find('.gdlr-core-skill-circle');
1141		}else{
1142			var elem = filter_elem.filter('.gdlr-core-skill-circle');
1143		}		
1144		
1145		elem.each(function(){
1146			var t = $(this);
1147
1148			// for responsive
1149			gdlr_core_skill_circle_height(t);
1150			$(window).on('resize gdlr-core-element-resize', function(){ gdlr_core_skill_circle_height(t); });
1151			
1152			// scroll action
1153			if( $(window).scrollTop() + $(window).height() > t.offset().top ){
1154				t.gdlr_core_pie_chart();
1155			}else{
1156				$(window).on('scroll pb-scroll', function(e){
1157					if( $(window).scrollTop() + $(window).height() > t.offset().top ){
1158						t.gdlr_core_pie_chart();
1159						$(window).unbind('scroll pb-scroll', e.handleObj.handler, e);
1160					} 
1161				});
1162			}
1163		});
1164	}
1165	
1166	// chart.js
1167	$.fn.gdlr_core_chart_js = function( filter_elem ){
1168		
1169		if( typeof(filter_elem) == 'undefined' ){
1170			var elem = $(this).find('.gdlr-core-chart-js');
1171		}else{
1172			var elem = filter_elem.filter('.gdlr-core-chart-js');
1173		}		
1174
1175		if( typeof(window.gdlr_core_chart_js_id) == 'undefined' ){
1176			window.gdlr_core_chart_js_id = 0;
1177		}
1178
1179		elem.each(function(){
1180
1181			var data = [];
1182			var options = [];
1183			if( $(this).attr('data-content') ){
1184				data = JSON.parse($(this).attr('data-content'));
1185			}
1186			if( $(this).attr('data-options') ){
1187				options = JSON.parse($(this).attr('data-options'));
1188			}
1189
1190			if( $(this).attr('data-type') == 'doughnut' || $(this).attr('data-type') == 'pie' ){
1191				if( options.legend.position == 'right' || options.legend.position == 'left' ){
1192					if( gdlr_core_display == 'mobile-portrait' || gdlr_core_display == 'mobile-landscape' ){
1193						options.legend.orig_position = options.legend.position;
1194						options.legend.position = 'bottom';
1195						$(this).attr('width', $(this).width());
1196						$(this).attr('height', $(this).width() * 1);
1197					}
1198				}
1199			}
1200			options.onResize = function(chart, size){
1201				if( chart.config.type == 'doughnut' || chart.config.type == 'pie' ){
1202					if( chart.config.options.legend.position == 'right' || chart.config.options.legend.position == 'left' ){
1203						if( gdlr_core_display == 'mobile-portrait' || gdlr_core_display == 'mobile-landscape' ){
1204							chart.config.options.legend.orig_position = chart.config.options.legend.position;
1205							chart.config.options.legend.position = 'bottom';
1206							chart.aspectRatio = 1;
1207						}
1208					}else if( typeof(chart.config.options.legend.orig_position) != 'undefined' ){
1209						if( gdlr_core_display == 'tablet' || gdlr_core_display == 'desktop' ){
1210							chart.config.options.legend.position = chart.config.options.legend.orig_position;
1211							chart.aspectRatio = 2;
1212						}
1213					}
1214					
1215				}
1216				
1217			}
1218
1219			var chartType = $(this).attr('data-type')? $(this).attr('data-type'): 'pie';
1220			if( chartType == 'horizontalBar' ){
1221				chartType = 'bar';
1222				options['indexAxis'] = 'y';
1223			}
1224
1225			new Chart($(this), {
1226			    type: chartType,
1227			    data: data,
1228			   	options: options
1229			});	
1230
1231		});
1232
1233	} // gdlr_core_chart_js
1234		
1235	// tab
1236	$.fn.gdlr_core_tab = function( filter_elem ){
1237		
1238		if( typeof(filter_elem) == 'undefined' ){
1239			var elem = $(this).find('.gdlr-core-tab-item, .gdlr-core-tab-action, .gdlr-core-roadmap-item, .gdlr-core-tab-feature-item, .gdlr-core-tab-feature2-item, .gdlr-core-tab-feature3-item, .gdlr-core-tab-featurev-item');
1240		}else{
1241			var elem = filter_elem.filter('.gdlr-core-tab-item, .gdlr-core-tab-action, .gdlr-core-roadmap-item, .gdlr-core-tab-feature-item, .gdlr-core-tab-feature2-item, .gdlr-core-tab-feature3-item, .gdlr-core-tab-featurev-item');
1242		}		
1243
1244		var url_hash = window.location.hash;
1245		if( url_hash ){
1246			url_hash = url_hash.replace('#', '');
1247
1248			elem.find('[data-tab-id="' + url_hash + '"]').each(function(){
1249				$(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
1250			});
1251		}
1252		
1253		elem.each(function(){
1254
1255			// click action
1256			$(this).find('.gdlr-core-tab-item-title, .gdlr-core-tab-action-title, .gdlr-core-roadmap-item-head, .gdlr-core-tab-feature-title-wrap, .gdlr-core-tab-feature2-title-wrap, .gdlr-core-tab-feature3-title-wrap, .gdlr-core-tab-featurev-title').click(function(){
1257				if( $(this).hasClass('gdlr-core-active') ) return;
1258				
1259				var tab_id = $(this).attr('data-tab-id');
1260				
1261				$(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
1262
1263				// for tab feature vertical
1264				if( $(this).is('.gdlr-core-tab-featurev-title') ){
1265					var parent = $(this).parent().parent();
1266
1267					parent.closest('.gdlr-core-tab-featurev-item').find('.gdlr-core-tab-featurev-background-switch').each(function(){
1268						$(this).children().removeClass('gdlr-core-active');
1269						$(this).children('[data-tab-id="' + tab_id + '"]').addClass('gdlr-core-active');
1270					});
1271				}else{
1272					var parent = $(this).parent();
1273				}
1274				parent.siblings('.gdlr-core-tab-item-content-wrap, .gdlr-core-tab-action-content-wrap, .gdlr-core-roadmap-item-content-wrap, .gdlr-core-tab-feature-item-content-wrap, .gdlr-core-tab-feature2-item-content-wrap, .gdlr-core-tab-feature3-item-content-wrap, .gdlr-core-tab-featurev-item-content-wrap').each(function(){
1275					var active_tab = $(this).children('[data-tab-id="' + tab_id + '"]');
1276
1277					if( active_tab.length ){
1278						active_tab.fadeIn(200).siblings().hide();
1279					}else{
1280						$(this).children().hide();
1281					}
1282				});
1283				
1284			});
1285			
1286			// hover action
1287			if( !(gdlr_core_mobile || gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') && 
1288				$(this).is('.gdlr-core-tab-feature2-item, .gdlr-core-tab-feature3-item') ){
1289
1290				var slide_bar_width = 35;
1291				var slide_bar = $(this).find('.gdlr-core-tab-feature2-bottom-slide-bar, .gdlr-core-tab-feature3-bottom-slide-bar');
1292				var active_tab = slide_bar.siblings('.gdlr-core-active');
1293				
1294				if( active_tab.length ){
1295					if( active_tab.is('.gdlr-core-tab-feature3-title-wrap') ){
1296						slide_bar_width = active_tab.outerWidth();
1297					}
1298					slide_bar.css({ width: slide_bar_width, left: active_tab.position().left + (active_tab.width() - slide_bar_width)/2 });
1299				}
1300				$(window).resize(function(){
1301					active_tab = slide_bar.siblings('.gdlr-core-active');
1302					if( active_tab.is('.gdlr-core-tab-feature3-title-wrap') ){
1303						slide_bar_width = active_tab.outerWidth();
1304					}
1305					slide_bar.css({ width: slide_bar_width, left: active_tab.position().left + (active_tab.width() - slide_bar_width)/2 });
1306				});
1307				$(this).find('.gdlr-core-tab-feature2-title-wrap, .gdlr-core-tab-feature3-title-wrap').click(function(){
1308					active_tab = $(this);
1309				});
1310				$(this).find('.gdlr-core-tab-feature2-title-wrap, .gdlr-core-tab-feature3-title-wrap').hover(function(){
1311					if( $(this).is('.gdlr-core-tab-feature3-title-wrap') ){
1312						slide_bar_width = $(this).outerWidth();
1313					}
1314					slide_bar.animate({ width: slide_bar_width, left: $(this).position().left + ($(this).width() - slide_bar_width)/2 }, {duration: 200, queue: false});
1315				}, function(){
1316					if( $(this).is('.gdlr-core-tab-feature3-title-wrap') ){
1317						slide_bar_width = $(this).outerWidth();
1318					}
1319					slide_bar.animate({ width: slide_bar_width, left: active_tab.position().left + (active_tab.width() - slide_bar_width)/2 }, {duration: 200, queue: false});
1320				});
1321				
1322			}
1323
1324			if( !(gdlr_core_mobile || gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') && 
1325				$(this).is('.gdlr-core-tab-style2-horizontal, .gdlr-core-tab-style2-vertical, .gdlr-core-tab-style3-horizontal') ){
1326
1327				var horizontal = $(this).is('.gdlr-core-tab-style2-horizontal, .gdlr-core-tab-style3-horizontal');
1328				var hover_line = $(this).find('.gdlr-core-tab-item-title-line');
1329				var hover_line_w = 0;
1330				var hover_line_l = 0;
1331				
1332				// initiate
1333				$(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-active').each(function(){
1334					if( horizontal ){
1335						hover_line_w = $(this).outerWidth();
1336						hover_line_l = $(this).position().left;
1337						hover_line.css({ width: hover_line_w, left: hover_line_l });
1338					}else{
1339						hover_line_w = $(this).outerHeight();
1340						hover_line_l = $(this).position().top;
1341						hover_line.css({ height: hover_line_w, top: hover_line_l });
1342					}
1343					hover_line.addClass('gdlr-core-initiated');
1344				});
1345				$(window).on('resize gdlr-core-element-resize', function(){
1346					$(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-active').each(function(){
1347						if( horizontal ){
1348							hover_line_w = $(this).outerWidth();
1349							hover_line_l = $(this).position().left;
1350							hover_line.css({ width: hover_line_w, left: hover_line_l });
1351						}else{
1352							hover_line_w = $(this).outerHeight();
1353							hover_line_l = $(this).position().top;
1354							hover_line.css({ height: hover_line_w, top: hover_line_l });
1355						}
1356					});
1357				});
1358				
1359				// animate
1360				$(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-tab-item-title').hover(function(){
1361					if( horizontal ){
1362						hover_line.animate({ width: $(this).outerWidth(), left: $(this).position().left }, { duration: 300, easing: 'easeOutQuart', queue: false });
1363					}else{
1364						hover_line.animate({ height: $(this).outerHeight(), top: $(this).position().top }, { duration: 300, easing: 'easeOutQuart', queue: false });
1365					}
1366				}, function(){
1367					if( horizontal ){
1368						hover_line.animate({ width: hover_line_w, left: hover_line_l }, { duration: 300, easing: 'easeOutQuart', queue: false });
1369					}else{
1370						hover_line.animate({ height: hover_line_w, top: hover_line_l }, { duration: 300, easing: 'easeOutQuart', queue: false });
1371					}
1372				});
1373				
1374				// click
1375				$(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-tab-item-title').click(function(){
1376					if( horizontal ){
1377						hover_line_w = $(this).outerWidth();
1378						hover_line_l = $(this).position().left;
1379						hover_line.css({ width: hover_line_w, left: hover_line_l });
1380					}else{
1381						hover_line_w = $(this).outerHeight();
1382						hover_line_l = $(this).position().top;
1383						hover_line.css({ height: hover_line_w, top: hover_line_l });
1384					}
1385				});
1386			}
1387		});
1388
1389		return $(this);
1390		
1391	} // gdlr_core_tab
1392
1393	$.fn.gdlr_core_price_table_tab = function( filter_elem ){
1394		if( typeof(filter_elem) == 'undefined' ){
1395			var elem = $(this).find('.gdlr-core-price-table-tab-title-wrap');
1396		}else{
1397			var elem = filter_elem.filter('.gdlr-core-price-table-tab-title-wrap');
1398		}
1399
1400		elem.each(function(){
1401
1402			var tab_title = $(this);
1403			tab_title.find('.gdlr-core-price-table-tab-title').on('click', function(){
1404				if( $(this).hasClass('gdlr-core-active') ) return;
1405
1406				var price_tab = $(this).attr('data-price-tab');
1407				$(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
1408				tab_title.siblings('.gdlr-core-price-table-tab-content-wrap').find('[data-price-tab="' + price_tab + '"]').each(function(){
1409					$(this).siblings('.gdlr-core-active').css({display: 'none'}).removeClass('gdlr-core-active');
1410					$(this).fadeIn(200).addClass('gdlr-core-active');
1411				});
1412			});
1413
1414		});
1415	}
1416
1417	$.fn.gdlr_core_sliding_gallery = function(filter_elem){
1418		if( typeof(filter_elem) == 'undefined' ){
1419			var elem = $(this).find('.gdlr-core-sliding-gallery');
1420		}else{
1421			var elem = filter_elem.filter('.gdlr-core-sliding-gallery');
1422		}	
1423		
1424		elem.each(function(){
1425			var container = $(this);
1426			var speed = container.attr('data-speed');
1427			var firstImage = $(this).children().first();
1428			var secondImage = firstImage.next();
1429
1430			if( !speed ){ 
1431				speed = 100; 
1432			}else{
1433				speed = parseFloat(speed) / 100;
1434			}
1435
1436			setInterval(function(){
1437				var margin_left = parseFloat(firstImage.css('margin-left'));
1438				margin_left -= speed;
1439
1440				firstImage.css('margin-left', margin_left);
1441
1442				if( secondImage.position().left <= 0 ){
1443					firstImage.css('margin-left', 0);
1444					container.append(firstImage);
1445					firstImage = secondImage;
1446					secondImage = firstImage.next();
1447				}
1448
1449				// console.log(secondImage.position().left);
1450			}, 10);
1451
1452		});
1453	}
1454	
1455	$.fn.gdlr_core_sly = function( filter_elem ){
1456
1457		if( typeof(filter_elem) == 'undefined' ){
1458			var elem = $(this).find('.gdlr-core-sly-slider');
1459		}else{
1460			var elem = filter_elem.filter('.gdlr-core-sly-slider');
1461		}	
1462	
1463		elem.addClass('gdlr-core-after-init').each(function(){
1464			var sly_slider = $(this);
1465			var sly_atts = {
1466				horizontal: 1,
1467				itemNav: 'basic',
1468				smart: 1,
1469				activateOn: 'click',
1470				mouseDragging: 1,
1471				touchDragging: 1,
1472				releaseSwing: 1,
1473				startAt: 0,
1474				scrollBy: 1,
1475				speed: 1000,
1476				elasticBounds: 1,
1477				easing: 'easeOutQuart',
1478				dragHandle: 1,
1479				dynamicHandle: 1,
1480				clickBar: 1,
1481				scrollBar: $(this).siblings('.gdlr-core-sly-scroll')
1482			};
1483
1484			if( sly_slider.hasClass('gdlr-core-with-bullet') ){
1485				var nav = $('<ul class="gdlr-core-sly-nav" ></ul>');
1486				nav.insertAfter(sly_slider);
1487
1488				sly_atts['pagesBar'] = nav;
1489				sly_atts['activatePageOn'] = 'click';
1490			}
1491
1492			sly_slider.sly(sly_atts);
1493			$(window).on('resize gdlr-core-element-resize', function(){ sly_slider.sly('reload'); });
1494		});
1495
1496		return $(this);
1497
1498	} // gdlr-core_sly
1499
1500	$.fn.gdlr_core_flexslider = function( filter_elem ){
1501
1502		if( typeof(filter_elem) == 'undefined' ){
1503			var elem = $(this).find('.gdlr-core-flexslider');
1504		}else{
1505			var elem = filter_elem.filter('.gdlr-core-flexslider');
1506		}	
1507	
1508		elem.each(function(){
1509
1510			var flex_attr = {
1511				useCSS: false,
1512				animation: 'fade',
1513				animationLoop: true,
1514				pauseOnHover: false,
1515				prevText: '<i class="arrow_carrot-left"></i>',
1516				nextText: '<i class="arrow_carrot-right"></i>'
1517			};
1518
1519			if( $(this).attr('data-start-at') && $(this).attr('data-start-at') > 1 ){
1520				flex_attr.startAt = $(this).attr('data-start-at') - 1;
1521			}
1522
1523			if( $(this).find('.gdlr-core-flexslider').length > 0 ){ 
1524				$(this).children('ul.slides').addClass('parent-slides');
1525				flex_attr.selector = '.parent-slides > li';
1526			}
1527
1528			// variable settings
1529			if( $(this).attr('data-disable-autoslide') ){
1530				flex_attr.slideshow = false;
1531			}
1532			if( $(this).attr('data-pausetime') ){
1533				flex_attr.slideshowSpeed = parseInt($(this).attr('data-pausetime'));
1534			}
1535			if( $(this).attr('data-slidespeed') ){
1536				flex_attr.animationSpeed = parseInt($(this).attr('data-slidespeed'));
1537			}else{
1538				flex_attr.animationSpeed = 500;
1539			}
1540
1541			// for carousel
1542			if( $(this).attr('data-type') == 'carousel' ){
1543				flex_attr.move = $(this).attr('data-move')? parseInt($(this).attr('data-move')): 1;
1544				flex_attr.animation = 'slide';
1545
1546				// determine the spaces
1547				var column_num = parseInt($(this).attr('data-column'));
1548				if( $(this).attr('data-margin') ){
1549					flex_attr.itemMargin = parseInt($(this).attr('data-margin'));
1550				}else{
1551					flex_attr.itemMargin = 2 * parseInt($(this).children('ul.slides').children('li:first-child').css('margin-right'));
1552				}
1553				flex_attr.itemWidth = (($(this).width() + flex_attr.itemMargin) / column_num) - (flex_attr.itemMargin);
1554
1555				flex_attr.minItems = column_num;
1556				flex_attr.maxItems = column_num;
1557				
1558				// if slide <= column no do nothing
1559				var slides = $(this).find('ul.slides').children();
1560				var flex_item = $(this);
1561				if( slides.length < column_num ){
1562					flex_item.addClass('gdlr-core-flex-inactive');
1563					$(window).on('resize gdlr-core-element-resize', function(){
1564						if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ){
1565							flex_item.removeClass('gdlr-core-flex-inactive');
1566						}else{
1567							flex_item.addClass('gdlr-core-flex-inactive');
1568						}
1569					});
1570				}
1571
1572
1573				// resize window
1574				var t = $(this);
1575				$(window).on('resize gdlr-core-element-resize', function(){
1576					if( t.data('goodlayers_flexslider') ){
1577						var newWidth = ((t.width() + flex_attr.itemMargin) / column_num) - (flex_attr.itemMargin);
1578						t.data('goodlayers_flexslider').editItemWidth(newWidth);
1579					}
1580				});
1581
1582			}else if( $(this).attr('data-effect') ){
1583				if( $(this).attr('data-effect') == 'kenburn' ){
1584					flex_attr.animation = 'fade';
1585				}else{
1586					flex_attr.animation = $(this).attr('data-effect');
1587				}
1588			}
1589
1590
1591			// for navigation
1592			var data_nav = ['both', 'navigation', 'navigation-outer-plain-round', 'navigation-top', 'navigation-bottom', 'navigation-inner', 'navigation-outer'];
1593			if( !$(this).attr('data-nav') || data_nav.indexOf($(this).attr('data-nav')) != -1 ){
1594				if( !$(this).hasClass('gdlr-core-bottom-nav-1') ){ /* old style fallback */
1595					if( $(this).attr('data-nav-parent') ){
1596						if( $(this).attr('data-nav-parent') == 'self' ){
1597							flex_attr.customDirectionNav = $(this).find('.flex-prev, .flex-next');
1598						}if( $(this).attr('data-nav-type') == 'custom' ){
1599							flex_attr.customDirectionNav = $(this).closest('.' + $(this).attr('data-nav-parent')).find('.flex-prev, .flex-next');
1600						}else{
1601							$(this).closest('.' + $(this).attr('data-nav-parent')).each(function(){
1602								var flex_nav = $('<ul class="flex-direction-nav">' + 
1603												'<li class="flex-nav-prev"><a class="flex-prev" aria-label="left arrow" href="#"><i class="arrow_carrot-left"></i></a></li>' +
1604												'<li class="flex-nav-next"><a class="flex-next" aria-label="right arrow" href="#"><i class="arrow_carrot-right"></i></a></li>' +
1605											'</ul>');
1606
1607								var flex_nav_position = $(this).find('.gdlr-core-flexslider-nav');
1608								if( flex_nav_position.length ){
1609									flex_nav_position.append(flex_nav);
1610									flex_attr.customDirectionNav = flex_nav.find('.flex-prev, .flex-next');
1611								}
1612							});
1613						}
1614					}
1615				}
1616			}else if( $(this).attr('data-nav') == 'touch-navigation' || $(this).attr('data-nav') == 'touch-navigation-bullet' ){
1617				var navFollow = $('<div class="goodlayers-carousel-nav-follow"></div>');
1618				navFollow.attr('data-type', 'touch-slide-black');
1619				var container = $(this).find('ul.slides');
1620				$(this).append( navFollow );
1621				
1622				container.get( 0 ).addEventListener('mousemove', function(e){
1623					if( !navFollow.hasClass('goodlayers-active') ){
1624						navFollow.addClass('goodlayers-active');
1625					}
1626
1627					navFollow.css({'left': e.clientX, 'top': e.clientY});
1628				});
1629				container.on('mouseleave', function(){
1630					navFollow.removeClass('goodlayers-active');
1631				});
1632				container.on('mouseenter', 'a', function(){
1633					navFollow.addClass('goodlayers-over-link');
1634				});
1635				container.on('mouseleave', 'a', function(){
1636					navFollow.removeClass('goodlayers-over-link');
1637				});
1638
1639				container.gdlr_core_monitor_swipe();
1640
1641				flex_attr.directionNav = false;
1642			}else{
1643				flex_attr.directionNav = false;
1644			}
1645			if( $(this).hasClass('gdlr-core-has-bullet') ){
1646				flex_attr.controlNav = true;
1647			}else{
1648				flex_attr.controlNav = false;
1649			}
1650
1651			// for thumbnail 
1652			if( $(this).attr('data-thumbnail') ){
1653				var thumbnail_slide = $(this).siblings('.gdlr-core-sly-slider');
1654
1655				flex_attr.manualControls = thumbnail_slide.find('ul.slides li')
1656				flex_attr.controlNav = true;
1657			}
1658
1659			// center the navigation
1660			// add active class for kenburn effects
1661			if( $(this).attr('data-vcenter-nav') ){
1662				flex_attr.start = function(slider){
1663					$(slider).children('.gdlr-core-flexslider-custom-nav.gdlr-core-style-navigation-outer').each(function(){
1664						$(this).insertAfter($(slider).children('.flex-viewport'));
1665					});
1666					if( slider.directionNav ){
1667						$(window).on('resize gdlr-core-element-resize', function(){
1668							slider.directionNav.each(function(){
1669								var margin = -(slider.height() + $(this).outerHeight()) / 2;
1670								$(this).css('margin-top', margin);
1671							});
1672						});
1673					}
1674					if( typeof(slider.slides) != 'undefined' ){
1675						$(window).trigger('gdlr-core-element-resize');
1676						slider.slides.filter('.flex-active-slide').addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
1677					}
1678				};
1679			}else{
1680				flex_attr.start = function(slider){
1681					if( typeof(slider.slides) != 'undefined' ){
1682
1683						if( $(slider).attr('data-controls-top-margin') ){
1684							$(slider).find('.flex-control-nav').css({ 'margin-top': $(slider).attr('data-controls-top-margin') });
1685						}
1686						
1687						$(slider).children('.gdlr-core-flexslider-custom-nav.gdlr-core-style-navigation-bottom').each(function(){
1688							$(this).insertAfter($(slider).children('.flex-viewport'));
1689						});
1690
1691						$(window).trigger('gdlr-core-element-resize');
1692						slider.slides.filter('.flex-active-slide').addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
1693					}
1694				}
1695			}
1696
1697			// add the action for class
1698			flex_attr.after = function(slider){
1699				slider.slides.filter('.flex-active-slide').addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
1700			}
1701
1702			// add outer frame class
1703			if( $(this).find('.gdlr-core-outer-frame-element').length > 0 ){
1704				$(this).addClass('gdlr-core-with-outer-frame-element');
1705			}
1706
1707			var slider_item =  $(this).goodlayers_flexslider(flex_attr);
1708
1709			// custom next prev nav
1710			$(this).find('.gdlr-custom-flex-prev, .gdlr-custom-flex-next').on('click', function(){
1711				if( $(this).is('.gdlr-custom-flex-prev') ){
1712					slider_item.goodlayers_flexslider('prev');
1713				}else{
1714					slider_item.goodlayers_flexslider('next');
1715				}
1716			});
1717			// custom next prev nav
1718			$(this).closest('.gdlr-core-flexslider-outer').find('.gdlr-core-flexslider-left-content-nav').each(function(){
1719				$(this).find('.gdlr-custom-flex-prev, .gdlr-custom-flex-next').on('click', function(){
1720					if( $(this).is('.gdlr-custom-flex-prev') ){
1721						slider_item.goodlayers_flexslider('prev');
1722					}else{
1723						slider_item.goodlayers_flexslider('next');
1724					}
1725				});
1726			});
1727			// touch slide
1728			$(this).find('ul.slides').on('swipeleft', function(){
1729				slider_item.goodlayers_flexslider('next');
1730			});
1731			$(this).find('ul.slides').on('swiperight', function(){
1732				slider_item.goodlayers_flexslider('prev');
1733			});
1734			
1735		});
1736
1737		return $(this);
1738
1739	} // gdlr-core-flexslier
1740
1741	window.gdlr_core_sticky_sidebar = function( filter_elem ){
1742
1743		if( typeof(filter_elem) == 'undefined' ){
1744			this.elem = $(this).find('.gdlr-core-sticky-sidebar');
1745		}else{
1746			this.elem = filter_elem.filter('.gdlr-core-sticky-sidebar');
1747		}
1748
1749		this.init();
1750
1751	}
1752	gdlr_core_sticky_sidebar.prototype = {
1753
1754		init: function(){
1755
1756			var t = this;
1757			t.elem.each(function(){
1758				$(this).find('.gdlr-core-pbf-sidebar-left, .gdlr-core-pbf-sidebar-right, .gdlr-core-sidebar-script').each(function(){
1759
1760					var sidebar_item = $(this);
1761					var sidebar_wrap = sidebar_item.parent();
1762					var sidebar_sub = $('<div></div>');
1763					var offset = sidebar_item.attr('data-sticky-offset');
1764					if( !offset ){
1765						offset = 0;
1766					}else{
1767						offset = parseInt(offset);
1768					}
1769
1770
1771					var prev_scroll = 0;
1772					$(window).on('scroll resize', function(e){
1773						
1774						// sidebar larger than content
1775						if( sidebar_item.outerHeight() >= sidebar_wrap.outerHeight() ){
1776							t.return_sidebar_pos(sidebar_sub, sidebar_item);
1777							return;
1778						} 
1779
1780						// not in desktop
1781						if( gdlr_core_display != 'desktop' ){
1782							t.return_sidebar_pos(sidebar_sub, sidebar_item);
1783							return;
1784						}
1785
1786						var scroll_pos = $(window).scrollTop();
1787						var scroll_direction = (prev_scroll > scroll_pos)? 'up': 'down';
1788						prev_scroll = scroll_pos;
1789
1790						// sidebar smaller than screen
1791						if( $(window).height() > sidebar_item.height() ){
1792
1793							if( scroll_pos + offset <= sidebar_wrap.offset().top ){
1794
1795								if( sidebar_item.hasClass('gdlr-core-fixed-sidebar') || sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){
1796									t.return_sidebar_pos(sidebar_sub, sidebar_item);
1797								}
1798
1799							}else{
1800								
1801								// overflow the content - stick to the bottom
1802								if( scroll_pos + sidebar_item.outerHeight() >= sidebar_wrap.offset().top + sidebar_wrap.outerHeight() ){
1803									
1804									if( !sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){
1805										t.set_sidebar_sub(sidebar_sub, sidebar_item);
1806
1807										sidebar_item.addClass('gdlr-core-fixed-bottom-sidebar').removeClass('gdlr-core-fixed-sidebar');
1808										sidebar_item.css({
1809											'position': 'absolute',
1810											'top': 'auto',
1811											'bottom': 0,
1812											'left': sidebar_sub.position().left,
1813											'width': sidebar_sub.outerWidth()
1814										});
1815									}
1816									
1817								// inside the content - fixed at the top
1818								}else{
1819
1820									if( !sidebar_item.hasClass('gdlr-core-fixed-sidebar') ){
1821										
1822										t.set_sidebar_sub(sidebar_sub, sidebar_item);
1823
1824										sidebar_item.addClass('gdlr-core-fixed-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar');
1825										sidebar_item.css({
1826											'position': 'fixed',
1827											'top': offset,
1828											'bottom': 'auto',
1829											'width': sidebar_sub.outerWidth()
1830										});
1831										sidebar_item.css({
1832											'left': sidebar_sub.offset().left,
1833										});
1834
1835									}
1836
1837								}
1838
1839								if( e.type == 'resize' ){
1840
1841									if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){
1842										sidebar_item.css({ 
1843											'width': sidebar_sub.outerWidth(),
1844											'left': sidebar_sub.position().left,
1845										});
1846									}else if( sidebar_item.hasClass('gdlr-core-fixed-sidebar') ){
1847										sidebar_item.css({ 
1848											'width': sidebar_sub.outerWidth(),
1849											'left': sidebar_sub.offset().left,
1850										});
1851									}
1852
1853								}
1854															
1855							}
1856
1857						// sidebar larger than screen
1858						}else{
1859
1860							// to the top
1861							if( scroll_pos <= sidebar_wrap.offset().top ){
1862
1863								if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') || sidebar_item.hasClass('gdlr-core-stick-bottom-sidebar') ||
1864									sidebar_item.hasClass('gdlr-core-fixed-top-sidebar') || sidebar_item.hasClass('gdlr-core-stick-top-sidebar') ){
1865									t.return_sidebar_pos(sidebar_sub, sidebar_item);
1866								}
1867
1868							}else{
1869
1870								// scroll direction down
1871								if( scroll_direction == 'down' ){
1872
1873									if( sidebar_item.hasClass('gdlr-core-fixed-top-sidebar') ){
1874
1875										t.set_sidebar_sub(sidebar_sub, sidebar_item);
1876
1877										sidebar_item.addClass('gdlr-core-stick-top-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar gdlr-core-stick-bottom-sidebar');
1878										sidebar_item.css({
1879											'position': 'absolute',
1880											'top': scroll_pos - sidebar_wrap.offset().top,
1881											'bottom': 'auto',
1882											'left': sidebar_sub.position().left,
1883											'width': sidebar_sub.outerWidth()
1884										});
1885
1886									// stick at the bottom
1887									}else if( scroll_pos + $(window).height() >= sidebar_wrap.offset().top + sidebar_wrap.outerHeight() ){
1888
1889										t.set_sidebar_sub(sidebar_sub, sidebar_item);
1890
1891										sidebar_item.addClass('gdlr-core-stick-bottom-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar gdlr-core-stick-top-sidebar');
1892										sidebar_item.css({
1893											'position': 'absolute',
1894											'top': 'auto',
1895											'bottom': 0,
1896											'left': sidebar_sub.position().left,
1897											'width': sidebar_sub.outerWidth()
1898										});
1899
1900									// fixed at the bottom
1901									}else if( scroll_pos + $(window).height() > sidebar_item.offset().top + sidebar_item.outerHeight() ){
1902
1903										t.set_sidebar_sub(sidebar_sub, sidebar_item);
1904
1905										sidebar_item.addClass('gdlr-core-fixed-bottom-sidebar').removeClass('gdlr-core-stick-bottom-sidebar gdlr-core-stick-top-sidebar gdlr-core-fixed-top-sidebar');
1906										sidebar_item.css({
1907											'position': 'fixed',
1908											'top': 'auto',
1909											'bottom': '0',
1910											'left': sidebar_sub.offset().left,
1911											'width': sidebar_sub.outerWidth()
1912										});
1913									}
1914
1915								// scroll direction up
1916								}else{
1917
1918									if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){
1919
1920										t.set_sidebar_sub(sidebar_sub, sidebar_item);
1921
1922										sidebar_item.addClass('gdlr-core-stick-bottom-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar gdlr-core-stick-top-sidebar');
1923										sidebar_item.css({
1924											'position': 'absolute',
1925											'top': scroll_pos + $(window).height() - sidebar_item.outerHeight() - sidebar_wrap.offset().top,
1926											'bottom': 'auto',
1927											'left': sidebar_sub.position().left,
1928											'width': sidebar_sub.outerWidth()
1929										});
1930
1931									}else{
1932
1933										// stick at the top
1934										if( scroll_pos < sidebar_item.offset().top ){
1935
1936											t.set_sidebar_sub(sidebar_sub, sidebar_item);
1937
1938											sidebar_item.addClass('gdlr-core-fixed-top-sidebar').removeClass('gdlr-core-stick-bottom-sidebar gdlr-core-fixed-bottom-sidebar gdlr-core-stick-top-sidebar');
1939											sidebar_item.css({
1940												'position': 'fixed',
1941												'top': '0',
1942												'bottom': 'auto',
1943												'left': sidebar_sub.offset().left,
1944												'width': sidebar_sub.outerWidth()
1945											});
1946
1947										}
1948									}
1949
1950									
1951
1952								}
1953
1954								if( e.type == 'resize' ){
1955									if( sidebar_item.hasClass('gdlr-core-stick-bottom-sidebar') || sidebar_item.hasClass('gdlr-core-stick-top-sidebar') ){
1956										sidebar_item.css({ 
1957											'width': sidebar_sub.outerWidth(),
1958											'left': sidebar_sub.position().left,
1959										});
1960									}else if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') || sidebar_item.hasClass('gdlr-core-fixed-top-sidebar') ){
1961										sidebar_item.css({ 
1962											'width': sidebar_sub.outerWidth(),
1963											'left': sidebar_sub.offset().left,
1964										});
1965									}
1966								}
1967
1968							}
1969						}
1970
1971					}); // window scroll
1972
1973				});
1974			});
1975
1976		},
1977
1978		set_sidebar_sub: function(sidebar_sub, sidebar_item){
1979
1980			if(sidebar_item.hasClass('gdlr-core-sidebar-sub-added')) return;
1981
1982			// set the width
1983			var sidebar_class = '';
1984			sidebar_item.each(function(){
1985				var className = this.className.match(/gdlr-core-column-\d+/);
1986				if( className ){
1987					sidebar_class = className[0];
1988				}
1989			});
1990			sidebar_sub.addClass(sidebar_class);
1991
1992			// set position
1993			sidebar_sub.css({
1994				'float': sidebar_item.css('float'),
1995				'height': 20,
1996				'background': '#fd9'
1997			});
1998
1999			sidebar_sub.insertAfter(sidebar_item);
2000			sidebar_item.addClass('gdlr-core-sidebar-sub-added');
2001		},
2002
2003		return_sidebar_pos: function(sidebar_sub, sidebar_item){
2004			sidebar_item.css({'position': '', 'top': '', 'bottom': '', 'left': '', 'width': '', 'height': ''});
2005			sidebar_item.removeClass('gdlr-core-fixed-sidebar gdlr-core-fixed-bottom-sidebar gdlr-core-sidebar-sub-added');
2006			sidebar_item.removeClass('gdlr-core-stick-bottom-sidebar gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar');
2007			sidebar_sub.remove();
2008		}
2009
2010	}
2011
2012	$.fn.gdlr_core_isotope = function( filter_elem ){
2013
2014		if(typeof($.fn.isotope) == 'function'){
2015
2016			if( typeof(filter_elem) == 'undefined' ){
2017				var elem = $(this).find('[data-layout="masonry"]');
2018			}else{
2019				var elem = filter_elem.filter('[data-layout="masonry"]');
2020			}
2021		
2022			elem.each(function(){
2023
2024				var t = $(this);
2025				if( t.children('ul.products').length ){
2026					t = t.children('ul.products');
2027				}
2028				var columnSize = t.width() / 60;
2029
2030				t.isotope({
2031					itemSelector: '.gdlr-core-item-list',
2032					layoutMode: 'masonry',
2033					masonry:{
2034						columnWidth: columnSize
2035					}
2036				});
2037				t.isotope();
2038
2039				t.find('.gdlr-core-item-list').gdlr_core_animate_list_item();
2040
2041				// resize event
2042				$(window).on('resize gdlr-core-element-resize', function(){
2043					
2044					columnSize = t.width() / 60;
2045					
2046					t.isotope({
2047						masonry:{
2048							columnWidth: columnSize
2049						}
2050					});
2051				});	
2052			});
2053
2054		}
2055
2056		return $(this);
2057
2058	} // gdlr-core-isotope
2059	$.fn.gdlr_core_animate_list_item = function(){
2060
2061		var ux_items = $(this).get();
2062
2063		// run the ux in order with delay
2064		var ux_interval = setInterval(function(){ 
2065			
2066			if( ux_items.length > 0 ){
2067				// animate the ux item
2068				var ux_animate = $(ux_items.shift());
2069				var animation_duration = '600ms';
2070
2071				ux_animate.css({'animation-duration': animation_duration});
2072				ux_animate.addClass('gdlr-core-animate');
2073				
2074				// remove selector
2075				setTimeout(function(){
2076					ux_animate.css({'animation-duration':  ''})
2077						.addClass('gdlr-core-animate-end')
2078						.removeClass('gdlr-core-animate gdlr-core-animate-init');
2079				}, parseInt(animation_duration));	
2080					
2081			}else{
2082				clearInterval(ux_interval);
2083			}
2084		}, 200);
2085
2086	}
2087
2088	$.fn.gdlr_core_lightbox = function( filter_elem ){
2089		
2090		// ilightbox
2091		if( typeof($.iLightBox) == 'function' ){
2092
2093			if( typeof(filter_elem) == 'undefined' ){
2094				var ilightbox = $(this).find('.gdlr-core-ilightbox');
2095			}else{
2096				var ilightbox = filter_elem.filter('.gdlr-core-ilightbox');
2097			}		
2098		
2099			var ilightbox_atts = {};
2100			var ilightbox_groups = [];
2101
2102			if( typeof(gdlr_core_pbf.ilightbox_skin) != 'undefined' ){
2103				ilightbox_atts['skin'] = gdlr_core_pbf.ilightbox_skin;
2104			}
2105
2106			ilightbox.each(function(){
2107				if( $(this).attr('data-ilightbox-group') ){
2108					if( ilightbox_groups.indexOf($(this).attr('data-ilightbox-group')) == -1 ){
2109						ilightbox_groups.push($(this).attr('data-ilightbox-group'));
2110					}
2111				}else{
2112					$(this).iLightBox(ilightbox_atts);
2113				}
2114			});
2115
2116			for( var key in ilightbox_groups ){
2117				$(this).find('.gdlr-core-ilightbox[data-ilightbox-group="' + ilightbox_groups[key] + '"]').iLightBox(ilightbox_atts);
2118			}
2119
2120		}else if( typeof($.fn.lightGallery) == 'function' ){
2121			
2122			if( typeof(filter_elem) == 'undefined' ){
2123				var lightgallery = $(this).find('.gdlr-core-lightgallery');
2124			}else{
2125				var lightgallery = filter_elem.filter('.gdlr-core-lightgallery');
2126			}
2127
2128			var lightbox_groups = [];
2129
2130			lightgallery.each(function(){
2131				if( $(this).attr('data-lightbox-group') ){
2132					if( lightbox_groups.indexOf($(this).attr('data-lightbox-group')) == -1 ){
2133						lightbox_groups.push($(this).attr('data-lightbox-group'));
2134					}
2135				}else{
2136					$(this).lightGallery({ selector: 'this' });
2137				}
2138			});
2139
2140			for( var key in lightbox_groups ){
2141				var group_selector = '.gdlr-core-lightgallery[data-lightbox-group="' + lightbox_groups[key] + '"]';
2142				
2143				lightgallery.filter(group_selector).first().lightGallery({ 
2144					selector: group_selector, 
2145					selectWithin: 'body',
2146					thumbnail: false
2147				});
2148			}
2149			
2150		}else if( typeof(lightGallery) == 'function' ){
2151			
2152			if( typeof(filter_elem) == 'undefined' ){
2153				var lightgallery = $(this).find('.gdlr-core-lightgallery');
2154			}else{
2155				var lightgallery = filter_elem.filter('.gdlr-core-lightgallery');
2156			}
2157
2158			var lightbox_groups = [];
2159
2160			lightgallery.each(function(){
2161				if( $(this).attr('data-lightbox-group') ){
2162					if( lightbox_groups.indexOf($(this).attr('data-lightbox-group')) == -1 ){
2163						lightbox_groups.push($(this).attr('data-lightbox-group'));
2164					}
2165				}else{
2166					lightGallery($(this).get(0), { 
2167						selector: 'this',
2168						plugins: [lgVideo, lgShare],
2169						zoomFromOrigin: false,
2170						mobileSettings: {
2171							showCloseIcon: true
2172						}
2173					});
2174				}
2175			});
2176
2177			for( var key in lightbox_groups ){
2178				var group_selector = '.gdlr-core-lightgallery[data-lightbox-group="' + lightbox_groups[key] + '"]';
2179				
2180				lightGallery(document.body, {
2181					selector: group_selector,
2182					plugins: [lgVideo, lgShare],
2183					zoomFromOrigin: false,
2184					mobileSettings: {
2185						showCloseIcon: true
2186					}
2187				});
2188			}
2189
2190		}
2191
2192		// lightbox gallery
2193		if( typeof(filter_elem) == 'undefined' ){
2194			var gallery_lb = $(this).find('[data-gallery-lb]');
2195		}else{
2196			var gallery_lb = filter_elem.filter('[data-gallery-lb]');
2197		}
2198
2199		gallery_lb.click(function(){
2200			if( typeof($.iLightBox) != 'undefined' ){
2201				$.iLightBox($(this).data('gallery-lb'));
2202			}else if(typeof(Strip) != 'undefined' ){
2203				Strip.show($(this).data('gallery-lb'));
2204			}else if(typeof($.fn.lightGallery) == 'function'){
2205				$(this).lightGallery({ 
2206					dynamic: true,
2207					dynamicEl: $(this).data('gallery-lb'),
2208					thumbnail: false,
2209					mobileSettings: {
2210						showCloseIcon: true
2211					}
2212				});
2213			}else if( typeof(lightGallery) == 'function' ){
2214				lightGallery($(this), {
2215					dynamic: true,
2216					dynamicEl: $(this).data('gallery-lb'),
2217					thumbnail: false,
2218					mobileSettings: {
2219						showCloseIcon: true
2220					}
2221				}).openGallery();
2222			}
2223
2224			return false;
2225		});
2226
2227		
2228		// image overlay
2229		if( typeof(filter_elem) == 'undefined' ){
2230			var center_overlay = $(this).find('.gdlr-core-image-overlay-center, .gdlr-core-image-overlay-center-icon');
2231		}else{
2232			var center_overlay = filter_elem.filter('.gdlr-core-image-overlay-center, .gdlr-core-image-overlay-center-icon');
2233		}		
2234	
2235		center_overlay.each(function(){
2236			
2237			// for portfolio overlay content style
2238			if( $(this).hasClass('gdlr-core-image-overlay-center') ){
2239				var overlay_content = $(this).children('.gdlr-core-image-overlay-content');
2240				var wrap_height = $(this).outerHeight() - (2 * parseInt(overlay_content.css('bottom')));
2241				
2242				var overlay_icon = overlay_content.children('.gdlr-core-portfolio-icon-wrap');
2243				var icon_margin = (wrap_height - (overlay_content.outerHeight() - parseInt(overlay_icon.css('margin-bottom')))) / 2;
2244				if( icon_margin > 20 ){
2245					overlay_icon.css('margin-bottom', icon_margin);
2246				}
2247				
2248			// normal centering
2249			}else{
2250				var content_offset = 0;
2251				if( $(this).children('.gdlr-core-image-overlay-content-offset').length ){
2252					content_offset = $(this).children('.gdlr-core-image-overlay-content-offset').outerHeight(true);
2253				}
2254
2255				$(this).children('.gdlr-core-image-overlay-content').each(function(){
2256					$(this).css({ 'margin-top': -( ($(this).outerHeight() + content_offset) / 2 ) });
2257				});
2258			}
2259			
2260		});
2261		$(window).on('resize gdlr-core-element-resize', function(){
2262			center_overlay.each(function(){
2263				// for portfolio style
2264				if( $(this).hasClass('gdlr-core-image-overlay-center') ){
2265					var overlay_content = $(this).children('.gdlr-core-image-overlay-content');
2266					var wrap_height = $(this).outerHeight() - (2 * parseInt(overlay_content.css('bottom')));
2267					
2268					var overlay_icon = overlay_content.children('.gdlr-core-portfolio-icon-wrap');
2269					var icon_margin = (wrap_height - (overlay_content.outerHeight() - parseInt(overlay_icon.css('margin-bottom')))) / 2;
2270					if( icon_margin > 20 ){
2271						overlay_icon.css('margin-bottom', icon_margin);
2272					}
2273					
2274				// normal centering
2275				}else{
2276					var content_offset = 0;
2277					if( $(this).children('.gdlr-core-image-overlay-content-offset').length ){
2278						content_offset = $(this).children('.gdlr-core-image-overlay-content-offset').outerHeight(true);
2279					}
2280
2281					$(this).children('.gdlr-core-image-overlay-content').each(function(){
2282						$(this).css({ 'margin-top': -( ($(this).outerHeight() + content_offset) / 2 ) });
2283					});
2284				}
2285			});
2286		});
2287
2288		return $(this);
2289	}
2290
2291	$.fn.gdlr_core_set_image_height = function(){
2292
2293		var all_image = $(this).find('img');
2294
2295		all_image.each(function(){
2296			var img_width = $(this).attr('width');
2297			var img_height = $(this).attr('height');
2298
2299			if( img_width && img_height ){
2300				var parent_item = $(this).parent('.gdlr-core-temp-image-wrap');
2301
2302				if( parent_item.length ){
2303					parent_item.height((img_height * $(this).parent().width()) / img_width);
2304				}else{
2305					parent_item = $('<div class="gdlr-core-temp-image-wrap" ></div>');
2306					parent_item.css('height', ((img_height * $(this).closest('span, div').width()) / img_width));
2307					$(this).wrap(parent_item);
2308				}
2309			}else{
2310				return;
2311			}
2312		});
2313		$(window).on('resize gdlr-core-element-resize', function(e){
2314			all_image.each(function(){
2315				var parent_item = $(this).parent('.gdlr-core-temp-image-wrap');
2316
2317				if( parent_item.length ){
2318					$(this).unwrap();
2319				}
2320			});
2321			
2322			$(window).unbind('resize', e.handleObj.handler, e);
2323		});
2324
2325		return $(this);
2326	} // gdlr_core_set_image_height
2327
2328	// to set full height wrapper / column
2329	window.gdlr_core_set_full_height = function( container, filter_elem ){
2330		if( typeof(filter_elem) == 'undefined' ){
2331			this.elements = container.find('.gdlr-core-wrapper-full-height, .gdlr-core-column-full-height');
2332		}else{
2333			this.elements = filter_elem.filter('.gdlr-core-wrapper-full-height, .gdlr-core-column-full-height');
2334		}
2335
2336		if( this.elements.length ){
2337			this.init();
2338		}
2339	}
2340	gdlr_core_set_full_height.prototype = {
2341
2342		init: function(){
2343
2344			var t = this;
2345
2346			t.resize();
2347			$(window).on('load resize gdlr-core-element-resize', function(){ t.resize(); });
2348		},
2349
2350		resize: function(){
2351
2352			this.elements.each(function(){
2353				var offset = $(this).attr('data-decrease-height')? parseInt($(this).attr('data-decrease-height')): 0;
2354
2355				$(this).css('min-height', $(window).height() - offset);
2356
2357				if( $(this).hasClass('gdlr-core-full-height-center') ){
2358					$(this).children('.gdlr-core-full-height-pre-spaces').remove();
2359
2360					var pre_space = ($(this).height() - $(this).children('.gdlr-core-full-height-content').outerHeight(true)) / 2;
2361					if( pre_space > 0 ){
2362						$(this).prepend($('<div class="gdlr-core-full-height-pre-spaces" ></div>').height(pre_space));
2363					}
2364				}
2365			});
2366
2367		}
2368	};
2369
2370	// sync height among items
2371	window.gdlr_core_sync_height = function( container, filter_elem ){
2372
2373		// for half height item
2374		this.set_half_height(container);
2375
2376		// sync height
2377		if( typeof(window.gdlr_core_sync_height_elem) != 'undefined' ){
2378			window.gdlr_core_sync_height_elem.reinit();
2379			return;
2380		}
2381		window.gdlr_core_sync_height_elem = this;
2382
2383		if( typeof(filter_elem) == 'undefined' ){
2384			this.elements = container.find('[data-sync-height]');
2385		}else{
2386			this.elements = filter_elem.filter('[data-sync-height]');
2387		}
2388		
2389		this.elements_group = [];
2390		this.container = container;
2391		this.init();
2392	} 
2393	gdlr_core_sync_height.prototype = {
2394
2395		init: function(){
2396
2397			var t = this;
2398			t.group_elements();	
2399			t.set_height();
2400
2401			$(window).on('load resize gdlr-core-element-resize', function(){ t.set_height(); });
2402		},
2403
2404		reinit: function(){
2405			
2406			if( !this.container.is('body, .gdlr-core-page-builder-body') ){
2407				this.container = this.container.closest('.gdlr-core-page-builder-body');
2408			}
2409
2410			this.elements = this.container.find('[data-sync-height]');
2411			this.group_elements();
2412			this.set_height();
2413
2414		},	
2415
2416		group_elements: function(){
2417
2418			var t = this;
2419			
2420			// do flipbox first
2421			t.elements.filter('.gdlr-core-flipbox-front, .gdlr-core-feature-box').each(function(){
2422				if( t.elements_group.indexOf($(this).attr('data-sync-height')) == -1 ){
2423					t.elements_group.push($(this).attr('data-sync-height'));
2424				}
2425			});
2426			
2427			// do the rest elements
2428			t.elements.each(function(){
2429				if( t.elements_group.indexOf($(this).attr('data-sync-height')) == -1 ){
2430					t.elements_group.push($(this).attr('data-sync-height'));
2431				}
2432			});
2433		},
2434
2435		set_height: function(){
2436
2437			var t = this;
2438
2439			// revert to default value
2440			t.elements.css('height', 'auto').children('.gdlr-core-sync-height-pre-spaces').remove();
2441			t.elements.find('.gdlr-core-sync-height-offset').remove();
2442
2443			var sync_element = t.elements;
2444			if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ){
2445				sync_element = sync_element.filter('.gdlr-core-flipbox-front, .gdlr-core-flipbox-back, .gdlr-core-hover-content-front, .gdlr-core-hover-content-back');
2446			}
2447
2448			// setting the height by each group
2449			for( var key in t.elements_group ){
2450				var max_height = 0;
2451
2452				// determine max height
2453				sync_element.filter('[data-sync-height="' + t.elements_group[key] + '"]').each(function(){
2454					if( $(this).outerHeight() > max_height ){
2455						max_height = $(this).outerHeight();
2456					}
2457				});
2458
2459				// set the height
2460				sync_element.filter('[data-sync-height="' + t.elements_group[key] + '"]').each(function(){
2461					
2462					// set the offset space to the bottom
2463					var offset = parseInt(max_height - $(this).outerHeight());
2464					var offset_item = $(this).find('[data-sync-height-offset]');
2465					if( offset_item.length && offset > 0 ){
2466						$('<div class="gdlr-core-sync-height-offset" ></div>').css('height', offset).insertBefore(offset_item);
2467					}
2468
2469					$(this).css('height', max_height);
2470
2471					// flipbox
2472					if( $(this).hasClass('gdlr-core-flipbox-front') ){
2473						$(this).parent().css('height', max_height);
2474					}
2475
2476					// center the content if selected
2477					if( $(this).is('[data-sync-height-center]') ){
2478						var content = $(this).children('.gdlr-core-sync-height-content');
2479						
2480						// determine top padding for centering content
2481						var padding_top = max_height;
2482						if( content.length > 0 ){
2483							padding_top -= content.outerHeight();
2484						}else{
2485							$(this).children().each(function(){
2486								padding_top -= $(this).outerHeight();
2487							});
2488						}
2489						padding_top = padding_top / 2;
2490						padding_top = padding_top - (parseInt($(this).css('padding-top')) + parseInt($(this).css('border-top-width')));
2491
2492						// insert the spaces
2493						if( padding_top > 0 ){
2494							var spaces_item = $('<div class="gdlr-core-sync-height-pre-spaces" ></div>').css('padding-top', padding_top);
2495							var space_position = $(this).children('.gdlr-core-sync-height-space-position');
2496							if( space_position.length > 0 ){
2497								spaces_item.insertBefore(space_position);
2498							}else{
2499								$(this).prepend(spaces_item);
2500							}
2501						}
2502					}
2503
2504				});
2505			}
2506
2507		},
2508
2509		set_half_height: function( container ){
2510
2511			container.find('.gdlr-core-half-height').each(function(){
2512				var temp = $(this);
2513				if( !gdlr_core_mobile && (gdlr_core_display == 'tablet' || gdlr_core_display == 'desktop') ){
2514					var temp_height = temp.outerHeight();
2515					temp.gdlr_core_set_image_height();
2516					temp.css('height', temp_height / 2);
2517					temp.find('img').css('margin-top', -temp_height/4);
2518				}
2519				$(window).on('load resize', function(){
2520					temp.css('height', 'auto');
2521					temp.find('img').css('margin-top', '0');
2522					if( !gdlr_core_mobile && (gdlr_core_display == 'tablet' || gdlr_core_display == 'desktop') ){
2523						temp_height = temp.outerHeight();
2524						temp.gdlr_core_set_image_height();
2525						temp.css('height', temp_height / 2);
2526						temp.find('img').css('margin-top', -temp_height/4);
2527					}
2528				});
2529			});
2530
2531		}
2532
2533	}; // gdlr_core_sync_height.prototype
2534
2535	function gdlr_core_ajax_action(ajax_section, name, value){
2536
2537		var now_loading = $('<div class="gdlr-core-now-loading" ></div>').hide();
2538
2539		$.ajax({
2540			type: 'POST',
2541			url: gdlr_core_pbf.ajax_url,
2542			data: { 
2543				'action': ajax_section.attr('data-ajax'), 
2544				'settings': ajax_section.data('settings'), 
2545				'option': { 'name':name, 'value':value } 
2546			},
2547			dataType: 'json',
2548			beforeSend: function(jqXHR, settings){
2549				// before send action
2550				if( ajax_section.attr('data-target-action') == 'replace' ){
2551					ajax_section.siblings('.' + ajax_section.attr('data-target')).animate({opacity: 0}, 150);
2552				}
2553
2554				// for portfolio item
2555				if( (ajax_section.attr('data-target') == 'gdlr-core-portfolio-item-holder' ||
2556					 ajax_section.attr('data-target') == 'gdlr-core-blog-item-holder' ||
2557					 ajax_section.attr('data-target') == 'gdlr-core-product-item-holder' ||
2558					 ajax_section.attr('data-target') == 'gdlr-core-product-item-table-holder' ||
2559					 ajax_section.attr('data-target') == 'gdlr-core-personnel-item-holder') && 
2560					ajax_section.attr('data-target-action') == 'replace' ){
2561
2562					now_loading.insertBefore( ajax_section.siblings('.gdlr-core-portfolio-item-holder, .gdlr-core-personnel-item-holder, .gdlr-core-blog-item-holder, .gdlr-core-product-item-holder, .gdlr-core-product-item-table-holder') );
2563					now_loading.fadeIn(200);
2564				}
2565			},
2566			error: function(jqXHR, textStatus, errorThrown){
2567				ajax_section.removeClass('gdlr-core-disable');
2568
2569				console.log(jqXHR, textStatus, errorThrown);
2570			},
2571			success: function(data){
2572				
2573				if( data.status == 'success' ){
2574					if( data.content && ajax_section.attr('data-target') ){
2575						if( ajax_section.attr('data-target-action') == 'append' ){
2576							var content = $(data.content);
2577							ajax_section.siblings('.' + ajax_section.attr('data-target')).each(function(){
2578
2579								if( $(this).attr('data-layout') != 'masonry' || typeof($.fn.isotope) != 'function' ){
2580									content.addClass('gdlr-core-animate-init');
2581								}
2582								$(this).append(content);
2583
2584								content.gdlr_core_lightbox().gdlr_core_flexslider().gdlr_core_content_script().gdlr_core_set_image_height();
2585								new gdlr_core_sync_height(content);
2586
2587								if( $(this).attr('data-layout') == 'masonry' && typeof($.fn.isotope) == 'function' ){
2588									var addItems = $(this).isotope('addItems', content);
2589									$(this).isotope('layoutItems', addItems, true);
2590								}else if( content.is('.gdlr-core-flexslider') ){
2591									content.gdlr_core_flexslider(content);
2592								}
2593								
2594								content.gdlr_core_animate_list_item();
2595							});
2596
2597							if( data.load_more ){
2598								if( data.load_more != 'none' ){
2599									var load_more = $(data.load_more);
2600									ajax_section.parent().append(load_more);
2601									load_more.gdlr_core_ajax(load_more);
2602									load_more.css('display', 'none').slideDown(100);
2603
2604									ajax_section.remove();
2605								}else{
2606									ajax_section.slideUp(100, function(){ $(this).remove(); });
2607								}
2608							}
2609							
2610						}else if( ajax_section.attr('data-target-action') == 'replace' ){
2611							var content = $(data.content);
2612							ajax_section.siblings('.' + ajax_section.attr('data-target')).each(function(){
2613								if( ajax_section.is('.gdlr-core-pagination') ){
2614									var scroll_position = $(this).offset().top - 120;
2615									if( $(window).scrollTop() > scroll_position ){
2616										$('html, body').animate({ scrollTop: scroll_position }, { duration: 1500, easing: 'easeOutQuart', queue: false });
2617									} 
2618								}
2619								
2620								var fix_height = false;
2621								var current_height = $(this).height();
2622
2623								if( $(this).attr('data-layout') != 'masonry' || typeof($.fn.isotope) != 'function' ){
2624									content.addClass('gdlr-core-animate-init');
2625								}
2626								$(this).empty().append(content);
2627
2628								content.gdlr_core_lightbox().gdlr_core_flexslider().gdlr_core_fluid_video().gdlr_core_set_image_height();
2629								new gdlr_core_sync_height(content);
2630
2631								var height_delay = 0;
2632								if( $(this).attr('data-layout') == 'masonry' && typeof($.fn.isotope) == 'function' ){
2633									$(this).isotope('destroy');
2634									$(this).parent().gdlr_core_isotope();
2635									fix_height = true;
2636								}else if( content.is('.gdlr-core-flexslider') ){
2637									content.gdlr_core_flexslider(content);
2638									height_delay = 300;
2639								}else{
2640									content.gdlr_core_animate_list_item();
2641								}
2642
2643								if( height_delay == 0 ){
2644									var new_height = $(this).height();
2645									$(this).css({height:current_height}).animate({'height':new_height, opacity:1}, {'duration':400, 'easing':'easeOutExpo', 'complete': function(){
2646										if( !fix_height ){ $(this).css('height',''); }
2647									}});
2648								}else{
2649									var current_item = $(this);
2650									current_item.css('height', current_height); 
2651									setTimeout(function(){
2652										current_item.css('height', ''); 
2653										var new_height = current_item.height();
2654										current_item.css({height:current_height}).animate({'height':new_height, opacity:1}, {'duration':400, 'easing':'easeOutExpo', 'complete': function(){
2655											if( !fix_height ){ current_item.css('height',''); }
2656										}});
2657									}, height_delay);
2658								}
2659								
2660							});
2661
2662							// pagination
2663							if( data.pagination ){
2664								ajax_section.siblings('.gdlr-core-pagination').slide
2664Up(100, function(){ $(this).remove(); });
2665
2666								if( data.pagination != 'none' ){
2667									var pagination = $(data.pagination);
2668									ajax_section.parent().append(pagination);
2669									pagination.gdlr_core_ajax(pagination);
2670									pagination.css('display', 'none').slideDown(100);
2671								}
2672							}
2673
2674							// load more button
2675							if( data.load_more ){
2676								ajax_section.siblings('.gdlr-core-load-more-wrap').slideUp(100, function(){ $(this).remove(); });
2677								
2678								if( data.load_more != 'none' ){
2679									var load_more = $(data.load_more);
2680									ajax_section.parent().append(load_more);
2681									load_more.gdlr_core_ajax(load_more);
2682									load_more.css('display', 'none').slideDown(100);
2683								}
2684							}
2685
2686						}
2687					}
2688
2689					if( typeof(data.settings) != 'undefined' ){
2690						ajax_section.data('settings', data.settings);
2691					}
2692
2693					now_loading.fadeOut(200, function(){ 
2694						$(this).remove(); 
2695						ajax_section.removeClass('gdlr-core-disable');
2696					});
2697				}else{
2698					ajax_section.removeClass('gdlr-core-disable');
2699				}
2700				
2701			}
2702		});	
2703
2704	} // gdlr_core_ajax_action
2705	$.fn.gdlr_core_ajax = function( filter_elem ){
2706
2707		if( typeof(filter_elem) == 'undefined' ){
2708			var elem = $(this).find('[data-ajax]');
2709		}else{
2710			var elem = filter_elem.filter('[data-ajax]');
2711		}
2712
2713		elem.each(function(){
2714
2715			var ajax_section = $(this);
2716
2717			// button click
2718			$(this).on('click', 'a, .gdlr-core-ajax-link', function(){
2719				if( $(this).hasClass('gdlr-core-active') || ajax_section.hasClass('gdlr-core-disable') ){
2720					return false;
2721				}
2722
2723				ajax_section.addClass('gdlr-core-disable');
2724				$(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
2725				
2726				var name = $(this).attr('data-ajax-name');
2727				var value = $(this).attr('data-ajax-value');
2728
2729				gdlr_core_ajax_action(ajax_section, name, value);
2730
2731				// for dropdown filterer
2732				var text = $(this).html();
2733				$(this).closest('.gdlr-core-filterer-dropdown').each(function(){
2734					$(this).siblings('.gdlr-core-filterer-dropdown-text').html(text);
2735				});
2736
2737				if( $(this).is('a') ){
2738					return false;
2739				}
2740			});
2741
2742			// filter changed
2743			$(this).on('change', 'select', function(){
2744				var name = $(this).attr('data-ajax-name');
2745				var value = $(this).val();
2746
2747				gdlr_core_ajax_action(ajax_section, name, value);
2748			});
2749
2750		});	
2751
2752	} // gdlr_core_ajax
2753	$.fn.gdlr_core_ajax_slide_bar = function( filter_elem ){
2754		if( typeof(filter_elem) == 'undefined' ){
2755			var elem = $(this).find('[data-ajax]');
2756		}else{
2757			var elem = filter_elem.filter('[data-ajax]');
2758		}
2759
2760		elem.each(function(){
2761
2762			var ajax_section = $(this);
2763
2764			// filter slide bar
2765			$(this).children('.gdlr-core-filterer-slide-bar').each(function(){
2766				var slide_bar = $(this);
2767				var active_slide = slide_bar.siblings('.gdlr-core-active');
2768				slide_bar.css({'width': active_slide.outerWidth(), 'left': active_slide.position().left + parseInt(active_slide.css('margin-left')) });
2769
2770				$(window).on('load resize', function(){
2771					active_slide = slide_bar.siblings('.gdlr-core-active');
2772					slide_bar.css({'width': active_slide.outerWidth(), 'left': active_slide.position().left + parseInt(active_slide.css('margin-left')) });
2773				});
2774				
2775				ajax_section.find('a').hover(function(){
2776					slide_bar.animate({'width': $(this).outerWidth(), 'left': $(this).position().left + parseInt($(this).css('margin-left')) }, {queue: false, duration: 200});
2777				}, function(){
2778					active_slide = slide_bar.siblings('.gdlr-core-active');
2779					slide_bar.animate({'width': active_slide.outerWidth(), 'left': active_slide.position().left + parseInt(active_slide.css('margin-left')) }, {queue: false, duration: 200});
2780				});
2781			});
2782
2783		});	
2784	}
2785
2786	$.fn.gdlr_core_dropdown_tab = function( filter_elem ){
2787
2788		if( typeof(filter_elem) == 'undefined' ){
2789			var elem = $(this).find('.gdlr-core-dropdown-tab');
2790		}else{
2791			var elem = filter_elem.filter('.gdlr-core-dropdown-tab');
2792		}	
2793	
2794		elem.each(function(){
2795			var tab_title = $(this).children('.gdlr-core-dropdown-tab-title');
2796			var tab_title_text = tab_title.children('.gdlr-core-head');
2797			var tab_dropdown = tab_title.children('.gdlr-core-dropdown-tab-head-wrap');
2798			var tab_content = $(this).children('.gdlr-core-dropdown-tab-content-wrap');
2799
2800			// dropdown
2801			tab_title.click(function(){
2802				if( $(this).hasClass('gdlr-core-active') ){
2803					$(this).removeClass('gdlr-core-active');
2804					tab_dropdown.hide();
2805				}else{
2806					$(this).addClass('gdlr-core-active');
2807					tab_dropdown.slideDown(200);
2808				}
2809			});
2810			tab_dropdown.children().click(function(){
2811				tab_title_text.html($(this).html());
2812				$(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
2813
2814				var content_active = tab_content.children('[data-index="' + $(this).attr('data-index') + '"]');
2815				content_active.fadeIn(200).addClass('gdlr-core-active');
2816				content_active.siblings().hide().removeClass('gdlr-core-active');
2817			});
2818
2819		});
2820
2821	} // gdlr_core_dropdown_tab
2822
2823	if( !gdlr_core_pbf.admin ){
2824		
2825		$(document).ready(function(){
2826
2827			var wpcf7_select = $('.wpcf7-form select');
2828			if( wpcf7_select.length ){
2829				$('<div class="wpcf7-form-indicator" ><i class="fa fa-angle-down" ></i></div>').insertAfter(wpcf7_select);
2830			}
2831			
2832			$('body').each(function(){
2833				
2834				// turns image link to open in lightbox
2835				if( $(this).hasClass('gdlr-core-link-to-lightbox') ){
2836					var image_link = $(this).find('a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"]')
2837						.not('.gdlr-core-ilightbox, .strip, [data-rel], .gdlr-core-lightgallery, .gdlr-core-social-share-pinterest')
2838						.addClass('strip gdlr-core-ilightbox gdlr-core-lightgallery').each(function(){
2839							
2840							if( $(this).closest('.gallery').length ){
2841								var gallery_wrap = $(this).closest('.gallery');
2842								if( gallery_wrap.attr('data-gallery-id') ){
2843									var gallery_id = gallery_wrap.attr('data-gallery-id');
2844								}else{
2845									var gallery_id = Math.floor((Math.random() * 10000) + 1);
2846									gallery_wrap.attr('data-gallery-id', gallery_id);
2847								}
2848
2849								$(this).attr('data-ilightbox-group', 'wp-gallery-' + gallery_id);
2850								$(this).attr('data-lightbox-group', 'wp-gallery-' + gallery_id);
2851								$(this).attr('data-strip-group', 'wp-gallery-' + gallery_id);
2852
2853							}
2854						});
2855					$(this).gdlr_core_lightbox( image_link );
2856				}
2857
2858				var gdlr_core_js = $(this).find('.gdlr-core-js, iframe[src*="youtube"], iframe[src*="vimeo"]');
2859				
2860				// video resizing
2861				$(this).gdlr_core_content_script( gdlr_core_js, true );
2862				
2863				// hover box
2864				$(this).gdlr_core_hover_box( gdlr_core_js );
2865
2866				// counter item
2867				$(this).gdlr_core_counter_item( gdlr_core_js );	
2868				
2869				// type animation item
2870				$(this).gdlr_core_typed_animation( gdlr_core_js );	
2871
2872				// countdown item
2873				$(this).gdlr_core_countdown_item( gdlr_core_js );		
2874
2875				// alert box item
2876				$(this).gdlr_core_alert_box_item( gdlr_core_js );
2877				
2878				// accordion item
2879				$(this).gdlr_core_accordion( gdlr_core_js );
2880				
2881				// toggle box item
2882				$(this).gdlr_core_toggle_box( gdlr_core_js );
2883				
2884				// divider
2885				$(this).gdlr_core_divider( gdlr_core_js );
2886				
2887				// flipbox
2888				$(this).gdlr_core_flipbox( gdlr_core_js );
2889				
2890				// marquee
2891				$(this).gdlr_core_marquee( gdlr_core_js );
2892
2893				// chart.js
2894				$(this).gdlr_core_chart_js( gdlr_core_js );
2895
2896				// skill circle
2897				$(this).gdlr_core_skill_circle( gdlr_core_js );
2898				
2899				// skill bar
2900				$(this).gdlr_core_skill_bar( gdlr_core_js );
2901				
2902				// tab
2903				$(this).gdlr_core_tab( gdlr_core_js );
2904				$(this).gdlr_core_price_table_tab( gdlr_core_js );
2905
2906				// dropdown tab
2907				$(this).gdlr_core_dropdown_tab( gdlr_core_js );
2908				
2909				// lightbox
2910				$(this).gdlr_core_lightbox( gdlr_core_js );
2911
2912				// ajax action
2913				$(this).gdlr_core_ajax( gdlr_core_js );
2914				$(this).gdlr_core_ajax_slide_bar( gdlr_core_js );
2915				
2916				// sync height
2917				new gdlr_core_sync_height( $(this), gdlr_core_js );
2918
2919				// set height
2920				new gdlr_core_set_full_height( $(this), gdlr_core_js );
2921
2922				// sidebar wrapper height
2923				new gdlr_core_sidebar_wrapper( $(this), gdlr_core_js );
2924				
2925				// ux animation
2926				// $(this).gdlr_core_ux( gdlr_core_js );
2927				new gdlr_core_ux( $(this), gdlr_core_js );
2928
2929				// feature content
2930				$('.gdlr-core-feature-content-wrap').each(function(){
2931					var fcontent = $(this);
2932					var pcontent = $(this).closest('.gdlr-core-feature-content');
2933
2934					pcontent.on('mouseenter', function(){
2935						fcontent.slideDown({
2936							duration: 350,
2937							queue: false,
2938							easing: 'easeOutCubic'
2939						});
2940					}).on('mouseleave', function(){
2941						fcontent.slideUp({
2942							duration: 350,
2943							queue: false,
2944							easing: 'easeOutCubic'
2945						});
2946					});
2947				});
2948				
2949				// background parallax
2950				$(this).gdlr_core_parallax_background( gdlr_core_js );
2951
2952				// particle
2953				$(this).gdlr_core_particle_background( gdlr_core_js );
2954
2955				// price plan
2956				$('.gdlr-core-price-plan-item').each(function(){
2957					var plan_options = $(this).children('.gdlr-core-price-plan-options');
2958					var plan_forms = $(this).children('.gdlr-core-price-plan-forms');
2959
2960					plan_options.find('.gdlr-core-active .gdlr-core-price-plan-content').css('display', 'block');
2961
2962					plan_options.on('click', '.gdlr-core-price-plan', function(){
2963						var price_plan = $(this);
2964						price_plan.find('.gdlr-core-price-plan-content').slideDown(150);
2965						price_plan.addClass('gdlr-core-active');
2966						price_plan.siblings('.gdlr-core-active').find('.gdlr-core-price-plan-content').slideUp(1
296650);
2967						price_plan.siblings('.gdlr-core-active').removeClass('gdlr-core-active');
2968					});
2969
2970					$('.gdlr-core-price-plan-item').on('click', '.gdlr-core-step2', function(){
2971						var selected_plan = parseInt($(this).siblings('.gdlr-core-price-plan.gdlr-core-active').attr('data-tab-id')) - 1;
2972						
2973						plan_forms.children().css('display', 'none');
2974						plan_forms.children().eq(selected_plan).css('display', 'block');
2975
2976						plan_options.hide();
2977						plan_forms.fadeIn();
2978					});
2979
2980					$('.gdlr-core-price-plan-forms').on('click', '.gdlr-core-step1', function(){	
2981						plan_options.fadeIn();
2982						plan_forms.hide();
2983					});
2984
2985				});
2986				
2987				// custom dropdown
2988				gdlr_core_js.filter('.gdlr-core-custom-dropdown').each(function(){
2989					var custom_dropdown = $(this);
2990					var dropdown_current = custom_dropdown.find('.gdlr-core-custom-dropdown-current');
2991
2992					$(this).on('click', '.gdlr-core-custom-dropdown-current', function(){
2993						dropdown_current.siblings('.gdlr-core-custom-dropdown-list').slideDown(150);
2994					});
2995					$(document).click(function(e){
2996						if( !$(e.target).is('.gdlr-core-custom-dropdown-current') ){
2997							dropdown_current.siblings('.gdlr-core-custom-dropdown-list').slideUp(150, function(){
2998								if( $(e.target).is('.gdlr-core-custom-dropdown-list-item') ){
2999									$(e.target).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active')
3000								}
3001							});
3002							if( $(e.target).is('.gdlr-core-custom-dropdown-list-item') ){
3003								dropdown_current.html( $(e.target).html() );
3004							}
3005						}
3006					});
3007				});
3008
3009				// privacy box cookie
3010				gdlr_core_js.filter('.gdlr-core-privacy-box-button').on('click', function(){
3011					var privacy_box_wrap = $(this).closest('.gdlr-core-privacy-box-wrap');
3012					if( privacy_box_wrap.is('.gdlr-core-pos-bottom-bar, .gdlr-core-pos-top-bar') ){
3013						privacy_box_wrap.slideUp(200);
3014					}else{
3015						privacy_box_wrap.fadeOut(250);
3016					}
3017
3018					var cookie_time = $(this).attr('data-cookie-time')? $(this).attr('data-cookie-time'): 2592000;
3019					gdlr_core_set_cookie('gdlr-core-privacy-box', 1, cookie_time);
3020					
3021					window.location.reload();
3022					
3023					return false;
3024				});
3025
3026				// gdlr lightbox
3027				gdlr_core_js.filter('[data-gdlr-lb]').each(function(){
3028					var lb_wrap = $('#' + $(this).data('gdlr-lb'));
3029					if( lb_wrap.length ){
3030						
3031						// open lightbox action
3032						$(this).on('click', function(){
3033							lb_wrap.fadeIn(200);
3034							return false;
3035						});
3036
3037						// bind the lightbox close action
3038						lb_wrap.find('.gdlr-core-lightbox-form-close').on('click', function(){
3039							$(this).closest('.gdlr-core-lightbox-wrapper').fadeOut();
3040							return false;
3041						});
3042					}
3043				});
3044
3045				// gdpr form
3046				gdlr_core_js.filter('#gdlr-core-gdpr-form').each(function(){
3047					
3048					// change tab
3049					$(this).on('click', '.gdlr-core-gdlr-form-nav li', function(){
3050						$(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
3051
3052						var nav_id = $(this).data('gdlr-nav');
3053						var content_wrap = $(this).closest('.gdlr-core-gdpr-form-left').siblings('.gdlr-core-gdpr-form-right');
3054						content_wrap.find('[data-gdlr-nav="' + nav_id + '"]').each(function(){
3055							$(this).siblings('[data-gdlr-nav]').removeClass('gdlr-core-active').css('display', 'none');
3056							$(this).fadeIn(200, function(){ $(this).addClass('gdlr-core-active'); });
3057						});
3058					});
3059				});
3060
3061				// sticky sidebar
3062				new gdlr_core_sticky_sidebar(gdlr_core_js);
3063			});
3064
3065		}); // document.ready
3066
3067		$(window).on('load', function(){
3068			
3069			$('body').each(function(){
3070
3071				var gdlr_core_js = $(this).find('.gdlr-core-js-2');
3072			
3073				// title divider
3074				$(this).gdlr_core_title_divider( gdlr_core_js );
3075
3076				// flexslider
3077				$(this).gdlr_core_flexslider( gdlr_core_js );
3078
3079				// sly slider
3080				$(this).gdlr_core_sly( gdlr_core_js );
3081
3082				// sliding
3083				$(this).gdlr_core_sliding_gallery( gdlr_core_js );
3084
3085				// isotope
3086				$(this).gdlr_core_isotope( gdlr_core_js );
3087
3088			});
3089
3090		}); // window.load
3091
3092	}
3093
3094})(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.