PageSourceSearch

https://darkgrey-stingray-867492.hostingersite.com/wp-content/themes/decofur/assets/js/functions.js?ver=7.1.2

js darkgrey-stingray-867492.hostingersite.com collected 2026-10-03 04:18:47 UTC 134,422 bytes, 4,046 lines download raw bytes

1/*
2 * Theme js functions file.
3 */
4 
5var $ 				= jQuery.noConflict(),
6	themejr_options 	= themejr_options || {},
7	themejr 			= themejr || {},
8	themejr_sliders 	= []; 
9(function($) { 
10	
11    "use strict";
12	
13	themejr.init = function() {
14		themejr.$doc          	= $(document);
15		themejr.$html    		= $('html');
16		themejr.$body 			= $(document.body);
17		themejr.$window 		= $(window);
18		themejr.$windowWidth 	= $(window).width();
19		themejr.$windowHeight 	= $(window).height();
20		themejr.ajaxXHR 		= null;
21		themejr.isPostLoading 	= false;
22		themejr.$tooltip 		= $('.product-buttons a,.whishlist-button a');
23		themejr.$swatches 		= themejr.$doc.find( 'div.themejr-swatches-wrap' );
24		themejr.$swatchForm 	= themejr.$doc.find( 'form.themejr-swatches-wrap.variations_form' );
25		
26		this.isCheckRTL();
27		this.mobileDevice();
28		this.BrowserDetection();
29		this.addSpinner();
30		this.backToTop();
31		this.imagelazyload();
32		this.reinitLazyload();
33		this.themejrElementorSwiperSlider();
34		this.initNanoScroller();
35		this.initMagnaficPopup();
36		this.newsLetterPopup();	
37		this.themejrMegamenu();
38		this.mobileMenu();
39		this.promoBar();
40		this.stickyHeader();
41		this.StickyHeaderScrollUP();
42		this.stickySidebar();
43		this.canvasSidebar();
44		this.openMiniSearch();
45		this.widgetMenuToggle();
46		this.widgetToggle();
47		this.footerWidgetCollapse();
48		this.widgetMaxLimitItem();
49		this.MasonryGrid();
50		this.loadmorePosts();
51		this.socialShare();
52		
53		/* Woocommerce */
54		this.productLiveSearch();
55		this.swapLoginSignupFrom();
56		this.userLoginSignupPopup();
57		this.miniCartWidget();		
58		this.addToWishlist();
59		this.wishlistCount();
60		this.addToCompare();
61		this.compareCount();		
62		this.removeToCompare();
63		this.ProductLoopQuantityField();
64		this.addToCart();
65		this.addToCartAjax();	
66		this.stickyAddToCart();
67		this.productQuickView();
68		this.productShowFilter();
69		this.productShowHideFilters();
70		this.productFilterAjax();
71		this.productSwatch();
72		this.initAjaxLoad();
73		this.loadmoreProducts();
74		this.tooltip();
75		this.productGallerySummarySticky();
76		this.productGallerySlider();
77		this.productImageZoom();
78		this.productPhotoSwipe();		
79		this.productSaleCountdown();
80		this.productReviewLink();
81		this.getProductSizeChart();
82		this.getAjaxBlock();
83		this.productQuantityPlusMinus();
84		this.productQuickShop();
85		this.productBoughtTogetherInit();
86		this.wooProductTabsAccordian();
87		this.wooProductTabsToggle();
88		this.wcfm_vendor();
89		this.MiniCartUpdateQuantity();
90		this.autoCartUpdate();
91		this.checkoutUpdateQuantity();
92		this.getVisitorCount();
93		this.askQuestionsForm();
94		
95		/* Elements */
96		this.themejrEqualTabsHeight();
97		this.themejrAjaxtab();
98		this.themejrResponsiveTab();
99		this.themejrProgressbar();
100		this.themejrCounterUp();
101		this.imageGaleryMasonry();
102		this.BackgroundParallax();
103		this.accordion();
104	}
105	
106	themejr.isCheckRTL = function(){
107		/*
108		* If check is site RTL
109		*/		
110		$('html[dir="rtl"] body').addClass('rtl');
111		var themejr_rtl = false;
112		if($('body,html').hasClass('rtl')){ 
113			themejr_rtl =  true;
114		}	
115		
116		return themejr_rtl;
117	};
118	
119	themejr.mobileDevice = function() {
120		var window_size = jQuery('body').innerWidth();
121		if(window_size < 991){
122			jQuery('body').addClass('themejr-mobile-device');
123		}else{
124			jQuery('body').removeClass('themejr-mobile-device');
125		}
126		 themejr.$window.on('resize', function () {
127			var window_size = jQuery('body').innerWidth();
128			if(window_size < 991){
129				jQuery('body').addClass('themejr-mobile-device');
130			}else{
131				jQuery('body').removeClass('themejr-mobile-device');
132			}
133		}); 
134	};
135	
136	themejr.BrowserDetection = function () {
137		/* Check if browser is IE */
138		if (navigator.userAgent.search("MSIE") >= 0) {
139			jQuery('body').addClass('browser-msie');
140		}
141		/* Check if browser is Chrome */
142		else if (navigator.userAgent.search("Chrome") >= 0) {
143			jQuery('body').addClass('browser-chrome');
144		}
145		/* Check if browser is Firefox  */
146		else if (navigator.userAgent.search("Firefox") >= 0) {
147			jQuery('body').addClass('browser-firefox');
148		}
149		/* Check if browser is Safari */
150		else if (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0) {
151			jQuery('body').addClass('browser-safari');
152		}
153		/* Check if browser is Opera */
154		else if (navigator.userAgent.search("Opera") >= 0) {
155			jQuery('body').addClass('browser-opera');
156		}
157	};
158	
159	themejr.addSpinner = function(){
160		/*
161		* Add Spinner
162		*/
163		
164		$( document ).ajaxStart(function() {
165			 $('.wcml_currency_switcher').append('<span class="themejr-spinner"></span>');
166		});
167		
168		$( document ).ajaxComplete(function() {
169			themejr.reinitLazyload();
170		  $('.wcml_currency_switcher > span').remove();
171		});	
172		
173			
174	};	
175	
176	themejr.backToTop = function(){
177		//*******************************************************************
178		//* Back to top button 
179		//********************************************************************/
180		var el = $('.themejr-back-to-top');
181		themejr.$window.on('scroll',function(){				
182			if(el.length > 0){
183				if( themejr.$window.scrollTop() > 150 ){
184					el.fadeIn(400);	
185				}else{
186					el.fadeOut(400);	
187				}	
188			}	
189		});
190		
191		el.on('click', function (e) {
192				$('html,body').animate({scrollTop:0}, 600);	
193				return false;
194		});				
195	};
196	
197	themejr.imagelazyload = function(){
198		if ( themejr.$body.find('.lazy').length > 0 && themejr_options.lazy_load ) {
199			var lazy_args = [];
200			lazy_args.afterLoad      = function (element) {
201				element.removeClass('lazy');
202				element.removeClass('loading');
203				element.addClass('lazy-loaded');
204			};
205			lazy_args.effect         = "fadeIn";
206			lazy_args.enableThrottle = true;
207			lazy_args.throttle       = 250;
208			lazy_args.effectTime     = 1000;
209			lazy_args.threshold      = 0;
210			themejr.$body.find('.lazy').lazy(lazy_args);			
211		}
212	};
213	
214	themejr.reinitLazyload = function(){
215		if ( !themejr_options.lazy_load )  return;
216		$(document).on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) {
217			themejr.imagelazyload();			
218		});
219		$(document).on('removed_from_cart', function (e) {
220			themejr.imagelazyload();			
221		});
222		$(window).bind('mousewheel DOMMouseScroll', function(event){
223			if (event.originalEvent.wheelDelta > 0 || event.originalEvent.detail < 0) {
224				
225			}
226			else {
227				themejr.imagelazyload();		
228			}
229		});
230	}
231	
232	themejr.initNanoScroller = function() {
233		/*
234		* Nano Scroller
235		*/		
236		if( $(window).width() < 1024 ) return;
237		$(".themejr-scroll").nanoScroller({
238			paneClass: 'themejr-scroll-pane',
239			sliderClass: 'themejr-scroll-slider',
240			contentClass: 'themejr-scroll-content',
241			preventPageScrolling: false
242		});
243
244		$( 'body' ).on( 'wc_fragments_refreshed wc_fragments_loaded added_to_cart', function() {
245			$(".widget_shopping_cart .themejr-scroll").nanoScroller({
246				paneClass: 'themejr-scroll-pane',
247				sliderClass: 'themejr-scroll-slider',
248				contentClass: 'themejr-scroll-content',
249				preventPageScrolling: false
250			});
251		} );
252	}
253	
254	themejr.initMagnaficPopup = function (){		
255		
256		var wordpress_galery = $(document).find('.gallery');
257		wordpress_galery.each(function(index){
258			var current_gallery = $(this);
259			$( current_gallery ).magnificPopup({
260				delegate: 'img',
261				type: 'image',
262				removalDelay: 500,
263				callbacks: {
264					beforeOpen: function() {
265						this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
266						this.st.mainClass = 'mfp-with-zoom mfp-img-mobile';
267					},
268					elementParse: function(item) {  item.src = item.el.attr('src'); }
269				},
270				image: {
271					verticalFit: true
272				},
273				gallery: {
274					enabled: true,
275					navigateByImgClick: true
276				},
277			});
278			
279		});
280		
281		$( '.product-360-degree-btn a' ).magnificPopup({
282		  type: 'inline',
283		  midClick: true,
284		  mainClass: 'mfp-fade'
285		});
286		
287		init_magnificpopup('.themejr-slider','.themejr-post-gallery__image.swiper-slide:not(.swiper-slide-duplicate) a');
288		init_magnificpopup('.product-sizechart','a.zoom-gallery');
289		
290		function init_magnificpopup(container,delegate){
291			
292			var container_wrap = $(document).find(container);
293			
294			if( typeof('container_wrap') !== 'undefined' && container_wrap != '' ) {
295				container_wrap.each(function(index){
296					var portfolio_item = $(this);
297					$(portfolio_item).magnificPopup({
298						delegate    : delegate,
299						type: 'image',
300						removalDelay: 500,
301						callbacks: {
302							beforeOpen: function() {
303								this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
304								this.st.mainClass = 'mfp-with-zoom mfp-img-mobile';
305							}
306						},
307						image: {
308							verticalFit: true
309						},
310						gallery: {
311							enabled: true,
312							navigateByImgClick: false
313						},
314					});
315					
316				});
317			}
318		}
319		
320		$('.link-popup').magnificPopup({
321			type: 'image',
322			removalDelay: 500,
323			callbacks: {
324				beforeOpen: function() {
325					this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
326					this.st.mainClass = 'mfp-with-zoom mfp-img-mobile';
327				}
328			},
329			image: {
330				verticalFit: true
331			},
332		});
333		
334		var $ombed_vids = $(".themejr-video-popup");
335		if( $ombed_vids.length > 0 ) {
336			$ombed_vids.each(function () {
337				var $mfp_popup_link_non_html5 = $(this);
338
339				$($mfp_popup_link_non_html5).magnificPopup({
340					disableOn: 320,
341					type: 'iframe',
342					mainClass: 'mfp-fade product-video-popup',
343					removalDelay: 160,
344					preloader: false,
345					fixedContentPos: false,
346					iframe: {
347						patterns: {
348							youtube: {
349								index: 'youtube.com/',
350								id: function(url) {
351									var m = url.match(/[\\?\\&]v=([^\\?\\&]+)/);
352									if ( !m || !m[1] ) return null;
353									return m[1];
354								},
355								src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0'
356							},
357							youtu: {
358								index: 'youtu.be',
359								id: '/',
360								src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0'
361							},
362							vimeo: {
363								index: 'vimeo.com/',
364								id: function(url) {
365									var m = url.match(/(https?:\/\/)?(www.)?(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/);
366									if ( !m || !m[5] ) return null;
367									return m[5];
368								},
369								src: '//player.vimeo.com/video/%id%?autoplay=1'
370							},
371						}
372					}
373				});
374			});
375		}		
376    };
377	
378	themejr.newsLetterPopup = function(){		
379		
380		if( !themejr_options.newsletter_args.newsletter_popup ){
381			return;
382		}
383		
384		var newsletter_popup 	= themejr_options.newsletter_args.newsletter_popup,
385			popup_display_on 	= themejr_options.newsletter_args.popup_display_on,
386			popup_delay 		= themejr_options.newsletter_args.popup_delay,
387			x_scroll 			= themejr_options.newsletter_args.popup_x_scroll,
388			show_for_mobile 	= themejr_options.newsletter_args.show_for_mobile,
389			popup_exit 			= false,
390			startinterval 		= false,
391			newsletter_key 		= 'themejr_newsletter_closed_' + themejr_options.newsletter_args.version,
392			popup_closed 		= Cookies.set( newsletter_key ),
393			$news_letter_wrap 	= $(".themejr-newsletter-popup"),
394			from_button         = false;
395		if( !$news_letter_wrap.length) {
396			return false;
397		}
398		/* yith-woocompare */
399		if(jQuery(document).find('#yith-woocompare').length > 0){
400			return false;
401		}
402		
403		if( ! newsletter_popup || themejr_options.maintenance_mode || ( ! show_for_mobile && $(window).width() < 768 ) ){
404			return false; 
405		}
406		
407		/* newsletter popup opened from button on click by user
408		it must be enabled even if with 'do-not-show' cookie saved */
409		var newsletter_btn = $('.header-newsletter');
410		newsletter_btn.on('click',function(){
411			from_button = true;
412			show_popup();
413		});
414		
415		
416		if( popup_closed == 'do-not-show' ) {
417			return false; 
418		}
419		
420		if( popup_display_on == 'exit' ){
421			jQuery(document).on('mouseleave', function (e) {
422				show_popup();
423			});
424		}else if(popup_display_on == 'scroll'){
425
426            jQuery(window).scroll(function () {
427                var h = jQuery(document).height() - jQuery(window).height();
428                var sp = jQuery(window).scrollTop();
429                var p = parseInt(sp / h * 100);
430
431                if (p >= x_scroll) {
432                   show_popup();                
433                }
434            });
435        }else{
436			if( popup_delay ){
437				setTimeout(function(){show_popup(); }, popup_delay * 1000);	
438			}else{
439				show_popup();
440			}			         
441        }
442		
443		$news_letter_wrap.find('.mc4wp-form').submit(function () {
444            Cookies.set( newsletter_key , 'do-not-show', { expires: parseInt(themejr_options.newsletter_args.show_in_next_days), path: '/' });
445        });
446		
447		function show_popup() {
448			/* popup must open everytime if the user clicked to open it */
449			if(popup_exit && !from_button){
450				return;
451			}
452			
453			popup_exit = true;
454			$.magnificPopup.open({
455				type: 'inline',
456				removalDelay: 500,
457				items: {
458					src: '.themejr-newsletter-popup' ,					
459				},
460				callbacks: {
461					open: function () {
462						var popupWrap = $( '.themejr-newsletter-popup' );
463						popupWrap.addClass('animated slideInDown');
464						
465						/* donotshow div element must be hidden if the user clicked to open popup */
466						if (from_button){
467							$('#newsletter-donotshow').parent('div').hide();
468						}
469						
470					},							
471					beforeClose: function() {
472						var popupWrap = $( '.themejr-newsletter-popup' );
473						popupWrap.removeClass('slideInDown').addClass('slideOutUp');
474					}, 
475					close: function() {
476						this.content.removeClass('animated slideOutUp'); 
477						/* check box click */
478						if($('#newsletter-donotshow:checked') && $('#newsletter-donotshow:checked').val() == 'do-not-show'){
479							Cookies.set( newsletter_key , 'do-not-show', { expires: parseInt(themejr_options.newsletter_args.show_in_next_days), path: '/' });
480						}
481						
482						/* we restore the default visibility of donotshow div element if the user clicked to open popup */
483						if (from_button) {
484							$('#newsletter-donotshow').parent('div').show();
485							from_button = false;
486						}
487					}
488				},				
489			});
490		}
491	};
492	
493	themejr.themejrMegamenu = function(){
494		
495		var main_menu_wrap 				= $('.themejr-main-navigation').find('ul.menu');
496		
497		main_menu_wrap.on('mouseover', ' > li.themejr-megamenu-dropdown:not(.themejr-megamenu-item-full-width)', function(e) {
498			setOffset( $(this) );
499		});
500		jQuery(window).resize(function() {
501			main_menu_wrap.on('mouseover', ' > li.themejr-megamenu-dropdown:not(.themejr-megamenu-item-full-width)', function(e) {
502				setOffset( $(this) );
503			});
504		});
505
506		var setOffset = function( li ) {
507
508			var megaMenuWrapper 		= li.find(' > .themejr-megamenu-wrapper'),
509				megaMenuHolder 			= li.find(' .themejr-megamenu-holder');
510			
511			megaMenuWrapper.attr('style', '');
512
513			var container	 			= $('.themejr-site-header .container'),
514				containerWidth 			= container.outerWidth(),
515				containerOffsetLeft 	= container.offset().left + 15,
516				containerPaddingLeft 	= parseInt(container.css('padding-left')),
517				containerPaddingRight 	= parseInt(container.css('padding-right')),
518				viewportWidth 		  	= containerWidth - containerPaddingLeft - containerPaddingRight;
519				
520			/* if( li.hasClass( 'themejr-megamenu-item-full-width' ) ) { 
521				megaMenuHolder.css({
522					width: viewportWidth
523				});
524			} */
525			
526			var	megaMenuWrapperWidth	= megaMenuWrapper.outerWidth(),
527				megaMenuWrapperOffset	= megaMenuWrapper.offset();		
528				
529			if( ! megaMenuWrapperWidth || ! megaMenuWrapperOffset ) return;
530			
531			var mega_menu_wrapOffsetRight = viewportWidth - megaMenuWrapperOffset.left - megaMenuWrapperWidth;
532			
533			if( $('body').hasClass('rtl') && mega_menu_wrapOffsetRight + megaMenuWrapperWidth + containerOffsetLeft >= viewportWidth && ( li.hasClass( 'themejr-megamenu-dropdown' ) ) ) {
534				
535				var toLeft = mega_menu_wrapOffsetRight + megaMenuWrapperWidth - viewportWidth + containerOffsetLeft;
536				megaMenuWrapper.css({
537					right: - toLeft
538				}); 
539
540			}else if( megaMenuWrapperOffset.left + megaMenuWrapperWidth - containerOffsetLeft >= viewportWidth && ( li.hasClass( 'themejr-megamenu-dropdown' ) ) ) {
541				
542				var toRight = megaMenuWrapperOffset.left + megaMenuWrapperWidth - viewportWidth - containerOffsetLeft;
543				megaMenuWrapper.css({
544					left: - toRight
545				}); 
546			}				
547		};	
548	}
549	
550	themejr.mobileMenu = function(){
551		/*
552		* Mobile menu
553		*/
554		
555		/* Menu wrapper */
556		$(document).on('click', '.mobile-nav-tabs li', function(e) {
557			if(!$(this).hasClass("active")){
558				var cn=$(this).data("menu");
559				$(this).parent().find(".active").removeClass("active");
560				$(this).addClass("active");
561				$(".mobile-nav-content").removeClass("active").fadeOut(300);
562				$(".mobile-"+cn+"-menu").addClass("active").fadeIn(300);
563			}
564		});
565		
566		/* Menu */
567		var $mobileMenu 	= $('.themejr-mobile-menu'),
568			$closeSidebar 	= $('.themejr-mask-overaly');
569		$( '.themejr-mobile-menu-btn .themejr-mobile-menu-toggle' ).on( 'click', function ( e ) {
570			e.preventDefault();			
571			if ( ! $mobileMenu.hasClass('opened') ) {
572				$mobileMenu.addClass('opened');
573				$closeSidebar.addClass('opened');
574			}
575		});
576
577		$( '.mobile-main-menu li.menu-item-has-children' ).append( '<span class="menu-toggle"></span>' );
578		
579		$mobileMenu.on('click', '.menu-item-has-children > .menu-toggle', function (e) {
580			e.preventDefault();
581
582			$(this).closest('li').siblings().find('ul').slideUp();
583			$(this).closest('li').siblings().removeClass('active');
584			$(this).closest('li').siblings().find('li').removeClass('active');
585
586			$(this).closest('li').children('ul').slideToggle();
587			$(this).closest('li').toggleClass('active');
588
589		});
590		
591		themejr.$body.on('click', '.themejr-mask-overaly, .themejr-mobile-menu .close-sidebar', function (e) {
592			if ( $mobileMenu.hasClass( 'opened' ) ) {
593				$mobileMenu.removeClass('opened');
594				$closeSidebar.removeClass('opened');
595			}
596		});
597		
598		themejr.$window.on('resize', function () {
599			if ( themejr.$window.width() > 991 ) {
600				if ( $mobileMenu.hasClass( 'opened' ) ) {
601					$mobileMenu.removeClass('opened');
602					$closeSidebar.removeClass('opened');
603				}
604			}
605		});
606	};
607	
608	themejr.promoBar = function(){
609		/*
610		 * Promo Bar
611		 */
612		var $promo_bar 			= $( '.themejr-promo-bar' ),
613			$siteWrapper 		= $( '.themejr-site-wrapper' ),
614			$siteHeader 		= $( '.themejr-site-header' ),
615			$stickyElements 	= $( '.header-sticky' ),
616			position_type 		= $promo_bar.attr('data-position_type'),
617			position 			= $promo_bar.attr('data-position'),
618			promo_barHeight 	= $promo_bar.outerHeight(),
619			adminBarHeight 		= $('#wpadminbar').outerHeight(),
620			promo_bar_key 		= 'themejr_promo_bar_close';
621			
622		if( position == 'top' && position_type == 'fixed'){
623			$siteWrapper.css({'margin-top' : promo_barHeight + 'px'});
624		}
625		/* Set a cookie and hide Promo bar when the dismiss button is clicked */
626		$( '.promo-bar-close' ).on( 'click', function( event ) {
627			event.preventDefault();
628			if( $(this).hasClass('promo-bar-dismiss') ) {
629				Cookies.set( promo_bar_key, true, { path: '/',expires: parseInt(themejr_options.show_promobar_in_next_days) } );
630			}
631			if( position == 'top' && position_type == 'fixed'){
632				$siteWrapper.css({'margin-top' : '0px'});
633			}
634			if( position == 'top' && position_type == 'fixed'){
635				if(adminBarHeight){
636					if( $siteHeader.hasClass('themejr-header-sticked')){
637					$stickyElements.css({
638					'top': adminBarHeight+'px'
639				});
640				}
641				}else{
642					if( $siteHeader.hasClass('themejr-header-sticked')){
643							$stickyElements.css({
644							'top': '0px'
645						});
646						}
647				}
648			}
649			$promo_bar.slideUp('slow',function(){ $(this).remove();});
650			
651		});
652	};
653	
654	themejr.stickyHeader = function(){
655		/*
656		 *  Sticky Header.
657		 */
658		if( ! themejr_options.sticky_header ){
659			return;
660		}
661		var $header 			= $('.themejr-site-header'),
662			$headerStickyClass 	= $('.header-' + themejr_options.sticky_header_class),
663			$window 			= themejr.$window,
664			origPosition 		= $(window).scrollTop(),
665			isSticked 			= false;
666			
667		if ( ! $headerStickyClass.length > 0 ) {
668			$headerStickyClass = $('.themejr-header-main');
669		}
670		
671		$window.on('scroll', function () {
672			var windowWidth 	= $(window).width(),
673				headerHeight 	= $header.outerHeight(),
674				stickyOffset 	= headerHeight + 200;
675			themejr.promoBar();
676			
677			/* Disable sticky in desktop & tablet & mobile */
678			if( ( !themejr_options.sticky_header && windowWidth > 992 ) ||
679				( !themejr_options.sticky_header_tablet && ( windowWidth <= 992 && windowWidth > 576 ) ) ||
680				( !themejr_options.sticky_header_mobile && windowWidth <= 575 ) ) {
681				return false; 
682			}
683			var currentScroll 	= $(this).scrollTop();
684			if ( currentScroll > stickyOffset ) {
685				stickHeader();
686			} else {
687				unstickHeader();
688			}
689		});
690		
691		function stickHeader() {
692			if ( isSticked ) { 
693				return; 
694			}
695			isSticked = true;
696			//var adminBarHeight 	= $('#wpadminbar').outerHeight();
697			
698			var adminBarHeight = 0, promo_top = 0, offset_top = 0;
699			
700			if( $('#wpadminbar').length > 0 ){
701				adminBarHeight 	= $('#wpadminbar').outerHeight();
702			}
703			
704			if( $('.position-top.position-type-fixed').length > 0 ){
705				promo_top 	= $('.position-top.position-type-fixed').outerHeight();
706			}
707			
708			offset_top = adminBarHeight + promo_top;
709			
710			$header.addClass('fixed');
711			$headerStickyClass.addClass('themejr-header-sticked');
712			$('.themejr-open-categories-menu .themejr-categories-menu-wrapper').removeClass('opened-categories');
713			$headerStickyClass.css({
714				'top': offset_top+'px'
715			});
716		}
717
718		function unstickHeader() {
719			if ( !isSticked ) { 
720				return;
721			}
722			isSticked = false;
723			$header.removeClass('fixed');
724			$headerStickyClass.removeClass('themejr-header-sticked');
725			$('.themejr-open-categories-menu .themejr-categories-menu-wrapper').addClass('opened-categories');
726			$headerStickyClass.css({
727				'top': 0
728			});
729		}
730	}
731	
732	themejr.StickyHeaderScrollUP = function(){
733		/*
734		 * Sticky header on ScrollUp
735		 */		
736		if ( ! themejr_options.sticky_header ||  ! themejr_options.sticky_header_scroll_up) { return; }
737				
738		var origPosition 		= $(window).scrollTop(),			
739			$headerStickyClass 	= $('.header-' + themejr_options.sticky_header_class);
740		
741		if ( ! $headerStickyClass.length > 0 ) {
742			$headerStickyClass = $('.themejr-header-main');
743		}
744
745		$(window).scroll(function(e) {
746			var currentScroll = $(window).scrollTop();
747			if( currentScroll > origPosition ) {
748				$headerStickyClass.removeClass( 'scroll-up' ).addClass( 'scroll-down' );
749			} else {
750				$headerStickyClass.removeClass( 'scroll-down' ).addClass( 'scroll-up' );
751			}
752			origPosition = currentScroll;
753		});
754	};
755	
756	themejr.stickySidebar = function(){
757		/*
758		 *  Sticky Sidebar.
759		 */
760		if ( ! themejr_options.sticky_sidebar ) { return; }
761		
762		if ( typeof ( $.fn.stick_in_parent ) != 'undefined' ) {
763			$(document).ready(function(){
764				if( $( window ).width() <= 768  ) { return; }
765				
766				var sticky_sidebar = $( '#secondary .sidebar-inner' );	
767				var offset = 15;
768				
769				if ( $( '#header .themejr-header-sticked' )[0] ) {
770					offset = $( '#header .themejr-header-sticked' ).height() + 30;
771				}
772				
773				sticky_sidebar.stick_in_parent({ offset_top: offset });
774				
775				$( window ).resize(function() {
776					if ( $( window ).width() <= 768 ) {
777						sticky_sidebar.trigger( 'sticky_kit:detach' );					
778					}else{
779						sticky_sidebar.stick_in_parent({
780							offset_top: offset
781						});
782					}
783				});
784			});
785		}
786	};
787	
788	themejr.canvasSidebar = function(){
789		/*
790		 *  Canvas Sidebar.
791		 */
792		
793		var sidebar_canvas 		= $('.themejr-canvas-sidebar .canvas-sidebar-icon, .themejr-product-off-canvas-btn, .themejr-mobile-navbar .canvas-sidebar-icon');
794		var secondary 			= $('#secondary');
795        var closeSidebar 		= $('.themejr-mask-overaly');
796		
797		sidebar_canvas.on('click', function(e) {
798			e.preventDefault();	
799			
800			if ( ! secondary.hasClass('opened') ) {
801				secondary.addClass('opened');
802				setTimeout(function() {themejr.imagelazyload();}, 1000);
803				closeSidebar.addClass('opened');
804			}					
805		});
806		
807		themejr.$body.on('click', '.themejr-mask-overaly, .close-sidebar', function (e) {
808			e.preventDefault();
809			secondary.removeClass('opened');
810			closeSidebar.removeClass('opened');
811		});	
812		
813		themejr.$window.on('resize', function () {
814			if ( themejr.$window.width() > 767 ) {
815				if ( secondary.hasClass( 'opened' ) ) {
816					secondary.removeClass('opened');
817					closeSidebar.removeClass('opened');
818				}
819			}
820		});
821		
822	};
823	
824	themejr.openMiniSearch = function(){
825		//*******************************************************************
826		//* openMiniSearch
827		//*******************************************************************/
828		
829		var sidebar_canvas 	= $('a.search-icon-text');
830		var search_popup 	= $('.themejr-search-popup');
831		var closeSidebar 	= $('.themejr-search-popup .close-sidebar');
832		
833		sidebar_canvas.on('click', function(e) {
834			e.preventDefault();
835			
836			if ( ! search_popup.hasClass('opened') ) {
837				search_popup.addClass('opened');
838			}					
839		});
840		
841		closeSidebar.on('click', function(e) {
842			e.preventDefault();
843			
844			if ( search_popup.hasClass('opened') ) {
845				search_popup.removeClass('opened');
846			}					
847		});		
848	};
849	
850	themejr.widgetMenuToggle = function(){
851		//*******************************************************************
852		//* Widget Menu Toggle
853		//*******************************************************************/
854		
855		if( themejr_options.widget_menu_toggle) {
856			/* Wordpress Menu widget */ 
857			$('#secondary .widget .menu-item > a').each(function(){ 
858				if( $(this).siblings('ul.sub-menu').length > 0 ) {
859					var $childIndicator = $('<span class="child-indicator"></span>');
860
861					$(this).siblings('.sub-menu').hide();
862					$('.current-menu-item > .sub-menu').show();
863					$('.current-menu-parent > .sub-menu').show();
864					if($(this).siblings('.sub-menu').is(':visible')){
865						$childIndicator.addClass( 'open-item' );
866					}
867
868					$childIndicator.on( 'click', function(){
869						$(this).parent().siblings('.sub-menu').toggle( 'fast', function(){
870							if($(this).is(':visible')){
871								$childIndicator.addClass( 'open-item' );
872							}else{
873								$childIndicator.removeClass( 'open-item' );
874							}
875						});
876						return false;
877					});
878					$(this).append($childIndicator);
879				}
880			});
881			
882			/* Product/Category widget */
883			$('#secondary .widget .cat-item > a').each(function(){
884				if( $(this).siblings('ul.children').length > 0 ) {
885					var $childIndicator = $('<span class="child-indicator"></span>');
886
887					$(this).siblings('.children').hide();
888					$('.current-cat > .children').show();
889					$('.current-cat-parent > .children').show();
890					if($(this).siblings('.children').is(':visible')){
891						$childIndicator.addClass( 'open-item' );
892					}
893
894					$childIndicator.on( 'click', function(){
895						$(this).parent().siblings('.children').toggle( 'fast', function(){
896							if($(this).is(':visible')){
897								$childIndicator.addClass( 'open-item' );
898							}else{
899								$childIndicator.removeClass( 'open-item' );
900							}
901						});
902						return false;
903					});
904					
905					if( ! $(this).find('.child-indicator').length > 0 ){
906						$(this).append($childIndicator);
907					}
908				}
909			});
910		}		
911	};
912	
913	themejr.widgetToggle = function(){
914		//*******************************************************************
915		//* Widget Menu Toggle
916		//*******************************************************************/		
917		if( themejr_options.widget_toggle) {
918			$( document ).find('.themejr-widget-area .widget, .widget-area .widget').addClass('widget-toggle').removeClass('closed');
919			$( document ).on( 'click', '.themejr-widget-area .widget .widget-title,.themejr-widget-area .widget .wp-block-group__inner-container > h2, .dokan-widget-area .widget .widget-title, .widget-area .widget .widget-title', function(e) {
920				e.stopImmediatePropagation();
921				if ($(this).next().is(':visible')){
922                    $(this).parent().addClass('closed');
923                } else {
924                    $(this).parent().removeClass('closed');
925                }
926                $(this).next().stop().slideToggle(200);
927			});			
928		}
929	};
930	
931	themejr.footerWidgetCollapse = function(){
932		//*******************************************************************
933		//* Footer Widget Collapse
934		//*******************************************************************/	
935		if ($(window).width() > 576) {
936			return;
937		}
938		$( document ).on( 'click', '.themejr-mobile-device .footer-widget-collapse .widget .widget-title', function(e) {
939			var $title 		= $(this);
940			var $widget 	= $title.parent();
941			var $content 	= $widget.find('> *:not(.widget-title)');
942
943			if ($widget.hasClass('footer-widget-opened')) {
944				$widget.removeClass('footer-widget-opened');
945				$content.stop().slideUp(200);
946			} else {
947				$widget.addClass('footer-widget-opened');
948				$content.stop().slideDown(200);
949			}
950					
951		});
952				
953	};
954	
955	themejr.widgetMaxLimitItem = function(){
956		//*******************************************************************
957		//* Widget Hide Max Limit Item
958		//*******************************************************************/
959		if( themejr_options.widget_hide_max_limit_item) {
960			var js_translate_text = themejr_options.js_translate_text;
961			$('#secondary .widget .widget-title + ul,#footer .widget .widget-title + ul').hideMaxListItems({
962				'max': themejr_options.number_of_show_widget_items,
963				'speed': 500,
964				'moreText': js_translate_text.show_more,
965				'lessText': js_translate_text.show_less
966			});
967		}
968	};
969	
970	themejr.MasonryGrid = function (){
971		
972		/*
973		* Init Masonry grid
974		*/
975		if($( '.articles-list.masonry-grid' ).length){
976			 themejr.$body.imagesLoaded(function () {
977				themejr.$body.find('.articles-list.masonry-grid').isotope({
978					itemSelector: '.type-post',
979					layoutMode: 'masonry'
980				});
981			});			
982		}
983	};
984	
985	themejr.loadmorePosts = function(){
986		
987		$('.themejr-blog-load-more .themejr-load-more').on('click',function(){
988			
989			var load_more_btn = $(this);
990			var page = parseInt(load_more_btn.parent().attr('data-page'));
991			var data_attr = load_more_btn.parent().data();
992			var	atts = data_attr.attribute;
993			var post_wrap = load_more_btn.closest('.themejr-element').find('.articles-list');
994            var wrap_id = load_more_btn.closest('.themejr-element').attr('id');
995			var data = {
996				action: 'themejr_loadmore_posts',
997				nonce: themejr_options.nonce,
998				attr: atts,
999				page: page,
1000			};
1001			if(load_more_btn.hasClass('process')){ return false;}
1002			themejr.loadAjaxPost(load_more_btn,data,post_wrap,wrap_id);
1003		});
1004		var animationFrame = function () {
1005			$('.themejr-blog-load-more a.infinity-scroll').each(function (i, val) {
1006				var load_more_btn = $(this);
1007				var page = parseInt(load_more_btn.parent().attr('data-page'));
1008				var post_wrap = load_more_btn.closest('.themejr-element').find('.articles-list');
1009				var wrap_id = load_more_btn.closest('.themejr-element').attr('id');
1010				var bottomOffset = post_wrap.offset().top + post_wrap.height() - $(window).scrollTop();
1011				if (bottomOffset < window.innerHeight && bottomOffset > 0) {
1012					if(load_more_btn.hasClass('process')){ 
1013						themejr.isPostLoading = true;
1014					}else{
1015						themejr.isPostLoading = false;
1016					}
1017					var page = parseInt(load_more_btn.parent().attr('data-page'));
1018					if(!load_more_btn.hasClass('themejr-loadmore-disabled')){ 
1019						load_more_btn.trigger('click');
1020					}
1021				}
1022			});
1023		}
1024		
1025		var scrollHandler = function () {
1026			requestAnimationFrame(animationFrame);
1027		};                    
1028		$(window).scroll(scrollHandler);
1029	}
1030	
1031	themejr.socialShare = function (){
1032		/*
1033		* Social Share
1034		*/
1035		themejr.$doc.on('click', '.social-print', function(){
1036			window.print();
1037			return false;
1038		});
1039
1040		/*
1041		 * Open Share buttons in a popup
1042		 */
1043		themejr.$doc.on('click', '.social-share a', function(){
1044			var link = jQuery(this).attr('href');
1045			if( link != '#' ){
1046				window.open( link, 'TIEshare', 'height=450,width=760,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0' );
1047				return false;
1048			}
1049		});
1050	};
1051	
1052	/* THEMEJR product live search */
1053	themejr.productLiveSearch = function () {
1054		$('.trending-search-wrap').hide();
1055		var serviceUrl = themejr_options.ajax_url + '?action=themejr_ajax_search';
1056		$('.themejr-ajax-search').each(function(){
1057			
1058			var append 				= $(this).find('.search-results-wrapper'),
1059				container 			= $(this),
1060				search_categories 	= $(this).find('.categories-filter'),
1061				product_cat 		= '';
1062
1063			if (search_categories.length && search_categories.val() !== '') {
1064				product_cat = search_categories.val();
1065			}
1066		
1067			$(this).find('.search-field').keyup(function(){
1068				 var search_text = $(this).val();
1069				 if(search_text.length < 3){
1070					$('.trending-search-wrap').show();
1071				 }else{
1072					 $('.trending-search-wrap').hide();
1073				 }
1074			});
1075			$(this).find('.search-field').focus(function() {
1076				var search_text = $(this).val();
1077				if(search_text.length < 3){
1078					$('.trending-search-wrap').show();
1079				}else{
1080					$('.trending-search-wrap').hide();
1081				}
1082			});
1083			$(this).find('.search-field').focusout(function() {
1084			});
1085			$(this).find('.search-field').devbridgeAutocomplete({
1086				minChars        : 3,
1087				appendTo        : append,
1088				triggerSelectOnValidInput: false,
1089				serviceUrl      : serviceUrl,
1090				type            : 'POST',
1091				params 			: { 'product_cat' : product_cat,nonce: themejr_options.nonce },
1092				onSearchStart   : function () { 
1093					container.find('.search-submit').removeClass('themejr-spinner');
1094					container.find('.search-submit').addClass('themejr-spinner');
1095					$('.trending-search-wrap').hide();
1096				},
1097				onSelect        : function (suggestion) {
1098					if (suggestion.id != -1) {
1099						window.location.href = suggestion.url;
1100					} 						
1101				},
1102				onSearchComplete: function () { 
1103					container.find('.search-submit').removeClass('themejr-spinner');
1104				},
1105				beforeRender: function (container) {					
1106					$(container).removeAttr('style');
1107				},
1108				formatResult: function (suggestion, currentValue) {
1109					
1110						var pattern = '(' + $.Autocomplete.utils.escapeRegExChars(currentValue) + ')';
1111						var html = '';
1112						if(suggestion.img) html += '<img class="search-image" src="'+suggestion.img+'">';
1113						html += '<div class="search-name">'+suggestion.value.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>')+'</div>';
1114						if(suggestion.price) html += '<span class="search-price">'+suggestion.price+'</span>';
1115						if(suggestion.rating) html += '<span class="search-rating">'+suggestion.rating+'</span>';
1116
1117						return html;
1118					}
1119			});
1120
1121			if( search_categories.length ){
1122				var searchForm = $(this).find('.search-field').devbridgeAutocomplete();
1123				search_categories.on( 'change', function( e ){
1124					if( search_categories.val() != '' ) {
1125						product_cat = search_categories.val();
1126						searchForm.setOptions({
1127							params : { 'product_cat' : product_cat, nonce: themejr_options.nonce }
1128							
1129						});
1130					} else{
1131						searchForm.setOptions({
1132							params : { 'product_cat' : '', nonce: themejr_options.nonce }
1133						});
1134					}
1135					/* update suggestions */
1136					searchForm.hide();
1137					searchForm.onValueChange();
1138				});
1139			}
1140		});
1141		 
1142		/* Hide .trending-search-wrap */
1143		$(document).mouseup(function (e){
1144			var container = $(".themejr-ajax-search");			
1145			if (!container.is(e.target) && container.has(e.target).length === 0){				
1146				$(".trending-search-wrap").hide();				
1147			}
1148		}); 
1149	};
1150	
1151	themejr.swapLoginSignupFrom = function () {
1152		/*
1153		* Swap Login Signup Form
1154		*/
1155		var userSignup 	= $('.themejr-new-register');
1156		var userSignin	= $('.themejr-new-login');
1157		
1158		userSignup.on('click', function(e) {
1159			e.preventDefault();	
1160			$('.themejr-customer-login').removeClass('active')
1161			$('.themejr-customer-register').addClass('active');
1162			
1163		});
1164		userSignin.on('click', function(e) {
1165			e.preventDefault();
1166			$('.themejr-customer-register').removeClass('active');
1167			$('.themejr-customer-login').addClass('active');
1168			
1169		});
1170	}
1171	
1172	themejr.userLoginSignupPopup = function () {
1173		/*
1174		* User Login Signup Popup
1175		*/
1176
1177		if( !themejr_options.login_register_popup || $('body').hasClass('woocommerce-account') )  return false;
1178		
1179		$('.customer-signinup').magnificPopup({
1180			type: 'inline',
1181			preloader: false,			
1182			removalDelay: 500,
1183			items: {
1184				src: '#themejr-login-register-popup' ,					
1185			},
1186			callbacks: {
1187				open: function() {
1188					var closeSidebar 	= $('.themejr-mask-overaly');
1189					var mobileSidebar = $('.themejr-mobile-menu');
1190					closeSidebar.removeClass('opened');
1191					mobileSidebar.removeClass('opened');
1192					$('.themejr-login-register-popup').addClass('animated slideInDown');
1193				},
1194				beforeClose: function() {
1195						var popupWrap = $( '.themejr-login-register-popup' );
1196						popupWrap.removeClass('slideInDown').addClass('slideOutUp');
1197					}, 
1198				close: function() {
1199					$('.themejr-login-register-popup').removeClass('animated slideOutUp');
1200					$('.themejr-login-register-popup').find('.signin-up-error-message').remove();
1201				}
1202			} 
1203		});
1204		
1205		if( themejr_options.button_loader ){
1206			$(document).on('click', '#themejr-login-register-popup .woocommerce-login-button .button', function(e) {
1207				var $this = $(this);
1208				var $loginform = $this.closest('form');			
1209				$this.addClass('loading');
1210			});		
1211			$(document).on('click', '#themejr-login-register-popup .woocommerce-form-register .woocommerce-Button.button', function(e) {			
1212				var $this = $(this),
1213				$regform = $this.closest('form');			
1214				$this.addClass('loading');		
1215			});	
1216		}
1217	};
1218	
1219	themejr.miniCartWidget = function () {
1220		/*
1221		 * Mini Cart Widget Sidebar
1222		 */
1223		 
1224		if ( 'slider' != themejr_options.header_minicart_popup ) { return false; }
1225
1226		var headerCart 		= $('.themejr-header-cart');
1227		var miniCartSidebar = $('.themejr-minicart-slide');
1228        var closeSidebar 	= $('.themejr-mask-overaly');
1229		var mobileSidebar = $('.themejr-mobile-menu');
1230		
1231		
1232		headerCart.on('click', function(e) {
1233			
1234			if( $('body').hasClass('woocommerce-cart') || $('body').hasClass('woocommerce-checkout') ) { return; };
1235			
1236			e.preventDefault();
1237			themejr.imagelazyload();
1238			if ( ! miniCartSidebar.hasClass('opened') ) {
1239				miniCartSidebar.addClass('opened');
1240				closeSidebar.addClass('opened');				
1241			}
1242			setTimeout(function(){
1243			 themejr.imagelazyload();
1244			}, 200);
1245
1246			
1247		});
1248		
1249		themejr.$body.on('click', '.themejr-mask-overaly, .close-sidebar', function (e) {
1250			e.preventDefault();
1251			miniCartSidebar.removeClass('opened');
1252			closeSidebar.removeClass('opened');
1253			mobileSidebar.removeClass('opened');
1254		});	
1255		 
1256		themejr.$doc.keyup( function( e ) {
1257            if ( e.keyCode === 27 ) {
1258				miniCartSidebar.removeClass('opened');
1259				closeSidebar.removeClass('opened');
1260			}
1261        });
1262	};
1263	
1264	themejr.addToWishlist = function(){
1265		/*
1266		* Add wishlist loader
1267		*/
1268       themejr.$body.on("click", ".add_to_wishlist", function() {
1269		  /*  Bootstrap tooltips hide */
1270			var tooltip_hide = ('.yith-wcwl-add-to-wishlist a');			
1271			$(tooltip_hide).tooltip('hide');
1272			
1273            $(this).addClass("loading");
1274        });
1275	}
1276	
1277	themejr.wishlistCount = function(){
1278		/*
1279		* Ajax Count Wishlist Product
1280		*/
1281		
1282		var themejr_ajax_wishlist_count = function() {
1283			$.ajax({
1284				type: 'POST',
1285				url: yith_wcwl_l10n.ajax_url,
1286				data      : {
1287					action	: 'themejr_ajax_wishlist_count',
1288					nonce   : themejr_options.nonce,
1289				},
1290				beforeSend: function () {
1291				},
1292				complete  : function () {
1293				},			
1294				success   : function (data) {
1295					$('span.themejr-header-wishlist-count').html(data);
1296					themejr.tooltip();
1297				}
1298			});
1299		};
1300		$('body').on( 'added_to_wishlist removed_from_wishlist', themejr_ajax_wishlist_count );
1301	};
1302	
1303	
1304	themejr.compareCount = function(){
1305		//*******************************************************************
1306		//* Ajax Count Compare Product
1307		//*******************************************************************/
1308		
1309		$('body').on( 'yith_woocompare_open_popup woocompare_open_popup_mod', function () {				
1310			$.ajax({
1311				type: 'post',
1312				url: themejr_options.ajax_url,
1313				data      : {
1314					action: 'themejr_ajax_compare_count',
1315					nonce	: themejr_options.nonce,
1316				},
1317				beforeSend: function () { 
1318				},
1319				complete  : function () { 
1320				},	
1321				success: function (response) { 
1322					$('span.themejr-header-compare-count').html(response);				
1323				},
1324				error: function(errorThrown){
1325					/* alert(errorThrown); */
1326			   } 
1327			});
1328		});
1329
1330		$(window).on('yith_woocompare_product_removed', function () {
1331			$('body').trigger('woocompare_open_popup_mod');
1332		});
1333		
1334		/* Remove product in compare product widget */
1335		$('.yith-woocompare-widget').on('click', 'li a.remove, a.clear-all', function (e) {
1336
1337			e.preventDefault();
1338			var product_id = $(this).data('product_id');
1339			
1340			$.ajax({
1341				type: 'post',
1342				url: themejr_options.ajax_url,
1343				data      : {
1344					action	: 'themejr_ajax_compare_count',
1345					nonce	: themejr_options.nonce,
1346					id		: product_id
1347				},
1348				beforeSend: function () { 
1349				},
1350				complete  : function () { 
1351				},	
1352				success: function (response) { 
1353					$('label.compare-count').html(response);				
1354				},
1355				error: function(errorThrown){
1356					/* alert(errorThrown); */
1357			   } 
1358			});
1359
1360		});
1361	};
1362	themejr.addToCompare = function () {
1363		
1364		/*
1365		* Add to compare list
1366		*/
1367		var button = $("a.compare");
1368
1369        themejr.$body.on("click", "a.compare", function() {
1370            $(this).addClass("loading");
1371        });
1372
1373        themejr.$body.on("yith_woocompare_open_popup", function() {
1374			
1375           themejr.$body.find('.compare').removeClass('loading');
1376           themejr.$body.addClass("compare-opened");
1377        });
1378
1379        themejr.$body.on('click', '#cboxClose, #cboxOverlay', function() {
1380            themejr.$body.removeClass("compare-opened");
1381        });
1382	}
1383	
1384	themejr.removeToCompare = function () {
1385		/*
1386		* Remove to compare list
1387		*/
1388		
1389		$(document).find('.compare-list').on('click', '.remove a', function (e) {
1390            e.preventDefault();
1391			$(this).addClass('loading');
1392            var compare_counter = $('.themejr-header-compare-count', window.parent.document).html();
1393            compare_counter = parseInt(compare_counter, 10) - 1;
1394            if (compare_counter < 0) {
1395                compare_counter = 0;
1396            }
1397
1398            $('.themejr-header-compare-count', window.parent.document).html(compare_counter);
1399        });
1400		
1401		themejr.$body.on("click", ".yith-woocompare-widget li a.remove", function(e) {
1402            e.preventDefault();
1403            var compare_counter = $(document).find('.themejr-header-compare-count').html();
1404            compare_counter = parseInt(compare_counter, 10) - 1;
1405            if (compare_counter < 0) {
1406                compare_counter = 0;
1407            }
1408
1409            setTimeout(function () {
1410                $(document).find('.themejr-header-compare-count').html(compare_counter);
1411            }, 2000);
1412
1413        });
1414
1415        themejr.$body.on("click", ".yith-woocompare-widget a.clear-all", function(e) {
1416            e.preventDefault();
1417            setTimeout(function () {
1418                $(document).find('.themejr-header-compare-count').html('0');
1419            }, 2000);
1420        });
1421		
1422		
1423	}
1424	
1425	themejr.ProductLoopQuantityField = function () {
1426		/*
1427		* Product Quantity Field
1428		*/		
1429		
1430		$(".woocommerce .themejr-product-buttons").on("change input", ".quantity .qty", function () {
1431		  var add_to_cart_button = $(this).parents(".product").find(".add_to_cart_button");
1432		  add_to_cart_button.attr("data-quantity", $(this).val());
1433		});
1434		$(".woocommerce .themejr-product-buttons").on("keypress", ".quantity .qty", function (e) {
1435		  if ((e.which || e.keyCode) === 13) {
1436			$(this).parents(".product").find(".add_to_cart_button").trigger("click");
1437		  }
1438		});
1439	}
1440	
1441	themejr.addToCart = function () {
1442		/*
1443		 *  Adding to cart
1444		 */
1445		 $('body').on('added_to_cart', function(event, fragments, cart_hash) {
1446			$.magnificPopup.close();
1447			if( $('.themejr-header-cart').length > 0 ) {
1448				if ( themejr_options.mini_cart_popup == '1' ) {
1449					$('.themejr-header-cart').trigger('click');
1450				}
1451			}
1452		 });
1453	};
1454	
1455	themejr.addToCartAjax = function () {
1456		/*
1457		 *  Adding to cart Ajax
1458		 */
1459		if ( ! themejr_options.enable_add_to_cart_ajax ) { return; }
1460		
1461		$('.single_add_to_cart_button').addClass('single_add_to_cart_ajax_button');
1462		themejr.$body.find('form.cart').on('click', '.single_add_to_cart_button', function (e) {
1463			 
1464			var $productWrapper = $(this).parents('.themejr-single-product-page');
1465            if ($productWrapper.hasClass('product-type-external')) return;          
1466
1467            var $form = $(this).closest('form.cart'),
1468                $singleBtn =  $(this),
1469				product_id = $form.find('input[name=add-to-cart]').val() || $singleBtn.val();
1470			if ($singleBtn.hasClass('disabled')) {
1471				return;
1472			}
1473			if ($singleBtn.hasClass('quick-buy-proceed')) {
1474				return;
1475			}
1476			if ($form.length > 0) {
1477                e.preventDefault();
1478            } else {
1479                return;
1480            }
1481			var data = {
1482				action			: 'themejr_ajax_add_to_cart',
1483				'add-to-cart'	: product_id,
1484				nonce   		: themejr_options.nonce,
1485			};
1486
1487			$form.serializeArray().forEach(function (element) {
1488				data[element.name] = element.value;
1489			});
1490			if ($singleBtn.hasClass('loading')) {
1491				return;
1492			}
1493			$singleBtn.addClass('loading');
1494			
1495			$(document.body).trigger('adding_to_cart', [$singleBtn, data]);
1496			$.ajax({
1497				type: 'post',
1498				url: themejr_options.ajax_url,
1499				data: data,
1500				beforeSend: function (response) {
1501					$singleBtn.removeClass('added').removeClass('not-added');
1502				},
1503				success: function (response) {
1504					if (response.error & response.product_url) {
1505					  window.location = response.product_url;
1506					  return;
1507					} else {
1508						if (typeof wc_add_to_cart_params !== 'undefined') {
1509							if (wc_add_to_cart_params.cart_redirect_after_add === 'yes') {
1510								window.location = wc_add_to_cart_params.cart_url;
1511								return;
1512							}
1513						}					
1514						
1515						/* Show notices */
1516                        if( response.notices.indexOf( 'error' ) > 0 ) {
1517                            $('.woocommerce-notices-wrapper').empty().append(response.notices);
1518							$singleBtn.addClass('not-added').removeClass('loading');
1519                        } else {
1520                            if ( themejr_options.product_open_cart_mini == '1' ) {
1521								$('.themejr-header-cart').trigger('click');
1522							}
1523							$singleBtn.addClass('added').removeClass('loading');
1524                            $(document.body).trigger('added_to_cart', [response.fragments, response.cart_hash, $singleBtn]);
1525                        }
1526						
1527					}
1528				},
1529			});
1530			
1531		});
1532	};
1533	
1534	themejr.stickyAddToCart = function(){
1535		/*
1536		* Sticky Add To Cart Bottom Button
1537		*/	
1538		
1539		if ( ! $('body').hasClass( 'single-product' ) || $('.themejr-sticky-add-to-cart').length == 0 || $(window).width() < 992 || $('.entry-summary form .single_add_to_cart_button').length == 0 ) {
1540			return;
1541		}
1542		
1543		$('body').on( 'click', '.themejr-sticky-add-to-cart .button', function (event) {
1544			event.preventDefault();			
1545			if( $(this).hasClass('variable') || $(this).hasClass('grouped') ){				
1546				$('html, body').animate({
1547					scrollTop: $(".variations").offset().top - 70
1548				}, 1000);
1549			}else{
1550				$(this).addClass('loading');
1551				$( '.entry-summary .single_add_to_cart_button' ).click();
1552				event.stopPropagation();				
1553			}
1554		});
1555		
1556		$(document.body).on( 'added_to_cart', function () {			
1557			$('.themejr-sticky-add-to-cart .button').removeClass('loading');
1558		});
1559		
1560		var cartButtonOffset = $('.entry-summary form .single_add_to_cart_button').offset().top;
1561		
1562		$(window).scroll(function(e) {			
1563			var documentHeight = $(document).height();
1564			var windowHeight = $(this).height();
1565			var scrollTop = $(this).scrollTop();
1566			var bottomscroll = parseInt( windowHeight + scrollTop ) + 100;
1567			
1568			if ( scrollTop > cartButtonOffset ) {
1569				$('.themejr-sticky-add-to-cart').slideDown();
1570				$('.themejr-back-to-top').addClass('sticky-add-cart');
1571			} else if ( scrollTop < cartButtonOffset) {
1572				$('.themejr-sticky-add-to-cart').slideUp(); /* Hide on bottom */
1573				$('.themejr-back-to-top').removeClass('sticky-add-cart');
1574			}
1575		});		
1576	};
1577	
1578	themejr.productQuickView = function () {
1579		/*
1580		* Product Quickview
1581		*/		
1582		themejr.$doc.on("click", ".themejr-quickview-btn", function(e) {
1583            e.preventDefault();
1584			var $btn = $(this),pid;
1585			if($btn.hasClass('loading')) return;
1586			$btn.addClass('loading');
1587			var pid           = $btn.attr( 'data-id' );
1588			$.ajax( {
1589				url    : themejr_options.ajax_url,
1590				data   : {
1591					action	: 'themejr_product_quick_view',
1592					pid   	: pid,
1593					nonce   : themejr_options.nonce,
1594				},
1595				timeout: 10000,
1596				success: function( response ) {
1597					$.magnificPopup.open({
1598						alignTop: true,
1599						removalDelay: 500,
1600						overflowY: 'scroll',
1601						items: {
1602						  src: '<div class="animated slideInDown themejr-quick-view woocommerce">' + response + '</div>', 
1603						  type: 'inline'
1604						},
1605						callbacks: {
1606							open: function () {
1607														
1608							},
1609							close: function () {
1610								themejr.singlePageSwatch();						
1611							},
1612							beforeClose: function() {
1613								var quickViewWrap = $( '.themejr-quick-view' );
1614								quickViewWrap.addClass('slideOutUp');
1615							},
1616						},
1617					});
1618					
1619					if( $('.woocommerce-product-gallery').find( '.single-product-gallery' ).length > 0 ) {
1620						$( '.single-product-gallery' ).not( '.slick-initialized' ).slick({
1621							slidesToShow	: 1,
1622							slidesToScroll	: 1,
1623							rtl				: ( themejr.isCheckRTL() ) ? true : false,
1624						});
1625					}
1626					$('.product-quick-view .woocommerce-product-gallery__image a').on('click', function(e){
1627						e.stopPropagation();
1628						e.preventDefault();
1629					});
1630					setTimeout(function() {
1631						var form_variation = $( '.product-quick-view' ).find( '.variations_form' );
1632						if ( form_variation.length > 0 ) {
1633							form_variation.trigger( 'check_variations' );
1634							form_variation.trigger( 'reset_image' );						
1635							form_variation.wc_variation_form();
1636							form_variation.find( 'select' ).change();
1637							themejr.singlePageSwatch();
1638							
1639						}
1640					}, 1000);
1641					
1642					
1643					$btn.removeClass( 'loading' );
1644					
1645					themejr.productSaleCountdown();
1646					themejr.addToCartAjax();
1647					themejr.productQuickShop();
1648					themejr.tooltip();
1649					themejr.imagelazyload();
1650					
1651				},
1652				error  : function( error ) {
1653					console.log( error );
1654					$btn.removeClass( 'loading' );
1655				},
1656
1657			} );
1658        });
1659	}
1660	themejr.productShowFilter = function () {
1661		$('.themejr-product-show .show-number').on('change', function () {
1662			 if ( !themejr.$body.hasClass('themejr-catalog-ajax-filter') ) {
1663				$( this ).closest( 'form' ).submit();
1664			}
1665      });
1666	}
1667	
1668	/* Get price js slider */
1669	themejr.priceSlider = function () {
1670		/* woocommerce_price_slider_params is required to continue, ensure the object exists */
1671		if (typeof woocommerce_price_slider_params === 'undefined') {
1672			return false;
1673		}
1674		
1675		if (!$('#main-content').find('.widget_price_filter').length) {
1676			return false;
1677		}
1678		
1679		/* Get markup ready for slider */
1680		$('input#min_price, input#max_price').hide();
1681		$('.price_slider, .price_label').show();
1682
1683		/* Price slider uses jquery ui */
1684		var min_price = $('.price_slider_amount #min_price').data('min'),
1685			max_price = $('.price_slider_amount #max_price').data('max'),
1686			current_min_price = parseInt(min_price, 10),
1687			current_max_price = parseInt(max_price, 10);
1688
1689		if ($('.price_slider_amount #min_price').val() != '') {
1690			current_min_price = parseInt($('.price_slider_amount #min_price').val(), 10);
1691		}
1692		if ($('.price_slider_amount #max_price').val() != '') {
1693			current_max_price = parseInt($('.price_slider_amount #max_price').val(), 10);
1694		}
1695
1696		$(document.body).on('price_slider_create price_slider_slide', function (event, min, max) {
1697			if (woocommerce_price_slider_params.currency_pos === 'left') {
1698
1699				$('.price_slider_amount span.from').html(woocommerce_price_slider_params.currency_symbol + min);
1700				$('.price_slider_amount span.to').html(woocommerce_price_slider_params.currency_symbol + max);
1701
1702			} else if (woocommerce_price_slider_params.currency_pos === 'left_space') {
1703
1704				$('.price_slider_amount span.from').html(woocommerce_price_slider_params.currency_symbol + ' ' + min);
1705				$('.price_slider_amount span.to').html(woocommerce_price_slider_params.currency_symbol + ' ' + max);
1706
1707			} else if (woocommerce_price_slider_params.currency_pos === 'right') {
1708
1709				$('.price_slider_amount span.from').html(min + woocommerce_price_slider_params.currency_symbol);
1710				$('.price_slider_amount span.to').html(max + woocommerce_price_slider_params.currency_symbol);
1711
1712			} else if (woocommerce_price_slider_params.currency_pos === 'right_space') {
1713
1714				$('.price_slider_amount span.from').html(min + ' ' + woocommerce_price_slider_params.currency_symbol);
1715				$('.price_slider_amount span.to').html(max + ' ' + woocommerce_price_slider_params.currency_symbol);
1716
1717			}
1718
1719			$(document.body).trigger('price_slider_updated', [min, max]);
1720		});
1721		if (typeof $.fn.slider !== 'undefined') {
1722			$('.price_slider').slider({
1723				range  : true,
1724				animate: true,
1725				min    : min_price,
1726				max    : max_price,
1727				values : [current_min_price, current_max_price],
1728				create : function () {
1729
1730					$('.price_slider_amount #min_price').val(current_min_price);
1731					$('.price_slider_amount #max_price').val(current_max_price);
1732
1733					$(document.body).trigger('price_slider_create', [current_min_price, current_max_price]);
1734				},
1735				slide  : function (event, ui) {
1736
1737					$('input#min_price').val(ui.values[0]);
1738					$('input#max_price').val(ui.values[1]);
1739
1740					$(document.body).trigger('price_slider_slide', [ui.values[0], ui.values[1]]);
1741				},
1742				change : function (event, ui) {
1743
1744					$(document.body).trigger('price_slider_change', [ui.values[0], ui.values[1]]);
1745				}
1746			});
1747		}
1748	};
1749	
1750	themejr.productShowHideFilters = function () {
1751		$('.archive.woocommerce').on('click','.themejr-product-filter-btn',function(e) {
1752			var $this = $(this),
1753			filter_content = $('#themejr-filter-widgets');
1754			$this.toggleClass("active");
1755			filter_content.toggleClass('active');
1756			filter_content.slideToggle('slow');			
1757      });
1758	}
1759	
1760	themejr.productFilterAjax = function () {
1761		if (!themejr.$body.hasClass('themejr-catalog-ajax-filter')) {
1762			return;
1763		}
1764		/* Price range filter*/
1765		$(document.body).on('price_slider_change', function (event, ui) {
1766			var form = $('.price_slider').closest('form').get(0),
1767			$form = $(form),
1768			url = $form.attr('action') + '?' + $form.serialize();
1769			$(document.body).trigger('themejr_shop_filter_ajax', url, $(this));
1770		});
1771		themejr.$body.on('click', '.widget_product_categories ul a, .widget_rating_filter ul a, .widget_layered_nav_filters ul a, .widget_product_tag_cloud a', function (e) {
1772            e.preventDefault();
1773            var url = $(this).attr('href');
1774            $(document.body).trigger('themejr_shop_filter_ajax', url, $(this));
1775        });
1776		themejr.$body.on('click','.themejr-products-view a',function(e) {			
1777			e.preventDefault();
1778			var $this = $(this),
1779			url = $this.attr('href');			
1780			$this.siblings().removeClass("active");
1781			$this.addClass('active');
1782			$(document.body).trigger('themejr_shop_filter_ajax', url, $this);
1783		});
1784		
1785		/* Shop paginataion filter*/
1786		$('.archive.woocommerce').on('change','.themejr-product-show .show-number',function(e) {			
1787			e.stopPropagation();
1788			var $this = $(this);
1789			var url = window.location.href.replace(/&per_page(=[^&]*)?|^per_page(=[^&]*)?&?/g, '').replace(/\?per_page(=[^&]*)?|^per_page(=[^&]*)?&?/g, '?').replace(/\?$/g, '');
1790
1791			if (url.indexOf('?') !== -1) {
1792				url = url + ('&per_page=' + $this.val());
1793			} else {
1794				url = url + ('?per_page=' + $this.val());
1795			}			
1796			$(document.body).trigger('themejr_shop_filter_ajax', url, $this);
1797		});		
1798		
1799		/* Shop paginataion filter*/
1800		$( document ).on( 'click', '.themejr-pagination .page-numbers:not(.current)', function(e) {
1801			e.preventDefault();
1802			var $this = $(this);
1803			var url = $this.attr('href');
1804			
1805			$(document.body).trigger('themejr_shop_filter_ajax', url, $this);
1806		});
1807		
1808		$('.archive.woocommerce').find('.woocommerce-ordering').off('change');
1809		$('.archive.woocommerce').on('change','.woocommerce-ordering',function(e) {
1810			var $this = $(this);
1811			var $select = $(e.currentTarget).find('.orderby');
1812			var url = window.location.href.replace(/&orderby(=[^&]*)?|^orderby(=[^&]*)?&?/g, '').replace(/\?orderby(=[^&]*)?|^orderby(=[^&]*)?&?/g, '?').replace(/\?$/g, '');
1813
1814			if (url.indexOf('?') !== -1) {
1815				url = url + ('&orderby=' + $select.val());
1816			} else {
1817				url = url + ('?orderby=' + $select.val());
1818			}
1819			$(document.body).trigger('themejr_shop_filter_ajax', url, $this);
1820		});
1821		
1822				
1823		/* Sorting filter*/
1824		$('.archive.woocommerce').on('click','.themejr_widget_product_sorting li',function(e) {
1825			e.preventDefault();
1826			var $this = $(this);
1827			var element = $this.find('a');
1828			var url = $this.find('a').attr('href');
1829			$this.siblings().removeClass("chosen");
1830			if($this.hasClass('chosen')){
1831                $this.removeClass('chosen');
1832            }else{
1833                $this.addClass('chosen');
1834            };
1835			
1836			$(document.body).trigger('themejr_shop_filter_ajax', url, element);
1837			
1838		});
1839		/* Clear filter*/
1840		$('.archive.woocommerce').on('click','.widget_layered_nav_filters a, .themejr-clear-filters-wrapp a',function(e) {
1841			e.preventDefault();
1842			var $this = $(this);
1843			
1844			var url = $this.attr('href');
1845			
1846			$(document.body).trigger('themejr_shop_filter_ajax', url, $this);
1847			
1848		});
1849		/* Attribute/Rating filter*/
1850		$('.archive.woocommerce').on('click','.widget_layered_nav li,.widget_rating_filter li,.widget_layered_nav_filters li',function(e) {
1851			e.preventDefault();
1852			var $this = $(this);
1853			var element = $this.find('a');
1854			var url = $this.find('a').attr('href');
1855			
1856			if($this.hasClass('chosen')){
1857                $this.removeClass('chosen');
1858            }else{
1859                $this.addClass('chosen');
1860            };
1861			
1862			$(document.body).trigger('themejr_shop_filter_ajax', url, element);
1863			
1864		});
1865		
1866		$(document.body).on('themejr_shop_filter_ajax', function (e, url, element) {
1867
1868			var $page_title = $('#page-title'),
1869				$product_container = $('#main-content .products-wrap'),
1870			    $main_content = $('#main-content');
1871				
1872			$('#themejr-filter-widgets').slideUp(200);
1873			if ($product_container.length > 0) {
1874				var position = $('.products').offset().top - 200;
1875				$('html, body').stop().animate({
1876						scrollTop: position
1877					},
1878					1200
1879				);
1880			}
1881			
1882			if ('?' == url.slice(-1)) {
1883				url = url.slice(0, -1);
1884			}
1885
1886			url = url.replace(/%2C/g, ',');
1887
1888			history.pushState(null, null, url);
1889
1890			$(document.body).trigger('themejr_ajax_filter_before_send_request', [url, element]);
1891
1892			if (themejr.ajaxXHR) {
1893				themejr.ajaxXHR.abort();
1894			}
1895	
1896			themejr.ajaxXHR = $.get(url, function (res) {
1897				$main_content.replaceWith($(res).find('#main-content'));
1898                $page_title.replaceWith($(res).find('#page-title').clone());
1899				$(document.body).trigger('themejr_ajax_filter_request_end', [res, url]);
1900			}, 'html');
1901		});
1902		
1903		$(document.body).on('themejr_ajax_filter_before_send_request', function () {
1904			
1905			var $product_container = $('#main-content .products-wrap');
1906			$product_container.addClass('products_overlay');
1907			$product_container.append('<div class="themejr_product_loading loading"></div>');
1908			$('#secondary').removeClass('opened');
1909			$('.themejr-mask-overaly').removeClass('opened');
1910			
1911		});
1912		
1913		$(document.body).on('themejr_ajax_filter_request_end', function () {
1914			themejr.priceSlider();
1915			themejr.imagelazyload();
1916			themejr.themejrElementorSwiperSlider();
1917			themejr.initAjaxLoad();
1918			themejr.tooltip();
1919			themejr.widgetToggle();
1920			themejr.widgetMenuToggle();
1921			themejr.widgetMaxLimitItem();
1922			themejr.stickySidebar();
1923			themejr.swatchInLoop();
1924			themejr.productQuickView();
1925			themejr.canvasSidebar();
1926			$('.themejr-mask-overaly').removeClass('opened');
1927		});
1928	}	
1929	
1930	themejr.productSwatch = function(){
1931		this.singlePageSwatch();
1932		this.swatchInLoop();
1933	}
1934	themejr.swatchSelectedLabel = function( element ){
1935		var $label = $( element ).closest( '.variation-swatche' ).find( '.label' ),
1936			$holder = $label.find( '.themejr-swatches-selected-label' ),
1937			$label_txt = $( element ).attr('title');
1938		if ( ! $holder.length ) {
1939			$holder = $( '<span class="themejr-swatches-selected-label" />' );
1940
1941			$label.append( $holder )
1942		}
1943		if ( $label_txt != '' ) {
1944			$holder.text( $label_txt ).show();
1945		} else {
1946			$holder.text( '' ).hide();
1947		}
1948	}
1949	themejr.singlePageSwatch = function () {
1950		
1951		var variationForm; 
1952		
1953		if( themejr.$doc.find( '.themejr-quick-view form.themejr-swatches-wrap.variations_form' ).length && !themejr.$doc.find( '.themejr-quick-view' ).hasClass( 'slideOutUp' ) ){
1954			variationForm 	= themejr.$doc.find( '.themejr-quick-view form.themejr-swatches-wrap.variations_form' );
1955		}else{
1956			variationForm 	= themejr.$doc.find( 'form.themejr-swatches-wrap.variations_form' );
1957		}
1958		var self 			= this,					
1959			$term 			= variationForm.find( '.swatch-term' ),
1960			$activeTerm 	= variationForm.find( '.swatch-term:not(.swatch-disabled)' );
1961		self.$swatchForm	= variationForm;
1962		
1963		$activeTerm.unbind( 'click' ).on( 'click', function () {
1964
1965			var $this 		= $( this ),
1966				term 		= $this.attr( 'data-term' ),
1967				attr 		= $this.parent().attr( 'data-attribute' ),
1968				$selectbox 	= self.$swatchForm.find( 'select#' + attr );
1969
1970			if ( $this.hasClass( 'swatch-disabled' ) ) {
1971				return false;
1972			}
1973
1974			$selectbox.val( term ).trigger( 'change' );
1975			$this.closest('.themejr-swatches').find( '.swatch-selected' ).removeClass( 'swatch-selected' );
1976			$this.addClass( 'swatch-selected' );
1977			themejr.swatchSelectedLabel(this);
1978		} );
1979
1980		self.$swatchForm.on( 'woocommerce_update_variation_values',
1981			function () {
1982				
1983				self.$swatchForm.find( 'select' ).each( function () {
1984					var $this 		= $( this );
1985					var $swatch 	= $this.parent().parent().find( '.themejr-swatches' );
1986					
1987					$swatch.find( '.swatch-term' ).removeClass( 'swatch-enabled' ).addClass( 'swatch-disabled' );
1988
1989					$this.find( 'option.enabled' ).each( function () {
1990						var val 	= $( this ).val();
1991						$swatch.find(
1992							'.swatch-term[data-term="' + val + '"]' ).removeClass( 'swatch-disabled' ).addClass( 'swatch-enabled' );
1993					} );
1994				} );
1995			} );
1996
1997		self.$swatchForm.on( 'reset_data', function () {
1998			if ( $('.themejr-swatches-selected-label').length ) {
1999				$('.themejr-swatches-selected-label').text('');
2000			}
2001			/* load default value */
2002			$term.each( function () {
2003				var $this = $( this ),
2004					term = $this.attr( 'data-term' ),
2005					attr = $this.parent().attr( 'data-attribute' ),
2006					$selectbox = self.$swatchForm.find( 'select#' + attr ),
2007					val = $selectbox.val();				
2008				if ( val != '' && term == val ) {				
2009					$( this ).addClass( 'swatch-selected' );
2010				}else{
2011					$( this ).removeClass( 'swatch-selected' );
2012				}
2013			} );
2014		
2015		} );
2016
2017	}
2018	themejr.swatchInLoop = function(){
2019		var self 			= this,
2020		swatchesInLoop 		= themejr.$doc.find( 'div.themejr-swatches-wrap' );
2021		self.$swatches 		= swatchesInLoop;
2022		self.$swatches.each( function () {
2023			var $swatches 	= $( this ),
2024			$term 			= $swatches.find(
2025				'.swatch-term:not(.swatch-disabled)' ),
2026			$resetBtn 		= $swatches.find(
2027				'.reset_variations--loop' ),
2028			$product 		= $swatches.closest('.product'),
2029			variationData 	= $.parseJSON(
2030			$swatches.attr( 'data-product_variations' ) );
2031			
2032			if ( $swatches.find( '.themejr-swatches' ).length == 0 ) {
2033				$swatches.addClass( 'swatch-empty' );
2034			}
2035			
2036			$term.unbind( 'click' ).on( 'click', function () {
2037
2038				var $this = $( this );
2039
2040				if ( $this.hasClass( 'swatch-disabled' ) ) {
2041					return false;
2042				}
2043
2044				var term = $this.attr( 'data-term' );				
2045				
2046				$product.find( '.swatch-term' ).removeClass( 'swatch-disabled swatch-enabled' );
2047				$this.parent().find( '.swatch-term.swatch-selected' ).removeClass( 'swatch-selected' );
2048
2049				if ( $this.hasClass( 'swatch-selected' ) ) {
2050					$this.parent().removeClass( 'swatch-activated' );
2051					$product.removeClass( 'swatch-product-swatched' );
2052
2053					if ( !$product.find( '.swatch-selected' ).length ) {
2054						$resetBtn.trigger( 'click' );
2055					}
2056				} else {
2057					$this.parent().addClass( 'swatch-activated' );
2058					$this.addClass( 'swatch-selected' );
2059
2060					$product.addClass( 'swatch-product-swatched' );
2061					/* $resetBtn.show(); */
2062				}
2063				
2064				var attributes 			= self.getChosenAttributes(
2065					$swatches ),
2066					currentAttributes 	= attributes.data;
2067				if ( attributes.count === attributes.chosenCount ) {
2068					self.updateAttributes( $swatches, variationData );
2069
2070					var matching_variations = self.findMatchingVariations(
2071						variationData, currentAttributes ),
2072						variation = matching_variations.shift();
2073
2074					if ( variation ) {
2075						/* Found variation */
2076						self.foundVariation( $swatches, variation );
2077					} else {
2078						
2079						$resetBtn.trigger( 'click' );
2080					}
2081				} else {
2082					
2083					self.updateAttributes( $swatches, variationData );
2084				} 
2085
2086			} );
2087			
2088			$resetBtn.unbind( 'click' ).on( 'click', function () {
2089
2090				$product.removeClass( 'swatch-product-swatched' );
2091
2092				$swatches.removeAttr( 'data-variation_id' );
2093				$swatches.find( '.swatch-swatch' ).removeClass( 'swatch-activated' );
2094				$swatches.find( '.swatch-term' ).removeClass(
2095					'swatch-enabled swatch-disabled swatch-selected' );
2096				
2097				/* reset image */
2098				self.variationsImageUpdate( false, $product );
2099
2100				$( this ).hide();
2101
2102				return false;
2103			} );					
2104		});
2105	};
2106	
2107	themejr.getChosenAttributes = function ( $swatches ) {
2108
2109		var data = {},
2110			count = 0,
2111			chosen = 0,
2112			$swatch = $swatches.find( '.themejr-swatches' );
2113
2114		$swatch.each( function () {
2115				var attribute_name = 'attribute_' +
2116						$( this ).attr( 'data-attribute' ),
2117					value = $( this ).find( '.swatch-term.swatch-selected' ).attr( 'data-term' ) || '';
2118
2119				if ( value.length > 0 ) {
2120					chosen++;
2121				}
2122
2123				count++;
2124				data[ attribute_name ] = value;			
2125		} );
2126
2127		return {
2128			'count': count,
2129			'chosenCount': chosen,
2130			'data': data,
2131		};
2132	}
2133	
2134	themejr.updateAttributes = function ( $swatches, variationData ) {
2135
2136		var self = this,
2137			attributes = self.getChosenAttributes( $swatches ),
2138			currentAttributes = attributes.data,
2139			available_options_count = 0,
2140			$swatch = $swatches.find( '.themejr-swatches' );
2141
2142		$swatch.each( function ( idx, el ) {
2143
2144			var current_attr_sw = $( el ),
2145				current_attr_name = 'attribute_' +
2146					current_attr_sw.attr(
2147						'data-attribute' ),
2148				selected_attr_val = current_attr_sw.find(
2149					'.swatch-term.swatch-selected' ).attr( 'data-term' ),
2150				selected_attr_val_valid = true,
2151				checkAttributes = $.extend( true, {},
2152					currentAttributes );
2153			
2154			checkAttributes[ current_attr_name ] = '';
2155			
2156			var variations = self.findMatchingVariations(
2157				variationData, checkAttributes );
2158			
2159			/* Loop through variations. */
2160			for (var num in variations) {
2161				if ( typeof variations[ num ] !== 'undefined' ) {
2162					var variationAttributes = variations[ num ].attributes;
2163
2164					for (var attr_name in variationAttributes) {
2165						if ( variationAttributes.hasOwnProperty(
2166								attr_name ) ) {
2167							var attr_val = variationAttributes[ attr_name ],
2168								variation_active = '';
2169							
2170							if ( attr_name === current_attr_name ) {
2171								if ( variations[ num ].variation_is_active ) {
2172									variation_active = 'enabled';
2173								}
2174								
2175								if ( attr_val ) {
2176									/* available */
2177									current_attr_sw.find(
2178										'.swatch-term[data-term="' + attr_val + '"]' ).addClass( 'swatch-' 
2178+ variation_active );
2179								}
2180								else {
2181									/* apply for all swatches */
2182									current_attr_sw.find( '.swatch-term' ).addClass( 'swatch-' + variation_active );
2183								}
2184							}
2185						}
2186					}
2187				}
2188			}
2189
2190			available_options_count = current_attr_sw.find(
2191				'.swatch-term.swatch-enabled' ).length;
2192
2193			if ( selected_attr_val && (
2194					available_options_count === 0 || current_attr_sw.find(
2195						'.swatch-term.swatch-enabled[data-term="' +
2196						self.addSlashes( selected_attr_val ) + '"]' ).length ===
2197					0
2198				) ) {
2199				selected_attr_val_valid = false;
2200			}
2201
2202			/* Disable terms not available */
2203			current_attr_sw.find( '.swatch-term:not(.swatch-enabled)' ).addClass( 'swatch-disabled' );
2204
2205			/* Choose selected value. */
2206			if ( selected_attr_val ) {
2207				/* If the previously selected value is no longer available,
2208				fall back to the placeholder (it's going to be there). */
2209				if ( !selected_attr_val_valid ) {
2210					current_attr_sw.find( '.swatch-term.swatch-selected' ).removeClass( 'swatch-selected' );
2211				}
2212			}
2213			else {
2214				current_attr_sw.find( '.swatch-term.swatch-selected' ).removeClass( 'swatch-selected' );
2215			}
2216		} );
2217	}
2218	
2219	themejr.addSlashes = function ( string ) {
2220		string = string.replace( /'/g, '\\\'' );
2221		string = string.replace( /"/g, '\\\"' );
2222		return string;
2223	}
2224
2225	themejr.findMatchingVariations = function ( variationData, settings ) {
2226		var matching = [];
2227		for (var i = 0; i < variationData.length; i++) {
2228			var variation = variationData[ i ];
2229
2230			if ( this.isMatch( variation.attributes, settings ) ) {
2231				matching.push( variation );
2232			}
2233		}
2234		return matching;
2235	}
2236
2237	themejr.isMatch = function ( variation_attributes, attributes ) {
2238		var match = true;
2239		for (var attr_name in variation_attributes) {
2240			if ( variation_attributes.hasOwnProperty( attr_name ) ) {
2241				var val1 = variation_attributes[ attr_name ];
2242				var val2 = attributes[ attr_name ];
2243				if ( val1 !== undefined && val2 !== undefined &&
2244					val1.length !== 0 && val2.length !== 0 &&
2245					val1 !== val2 ) {
2246					match = false;
2247				}
2248			}
2249		}
2250		return match;
2251	}
2252
2253	themejr.foundVariation = function ( $swatches, variation ) {
2254
2255		var self = this,
2256		$product = $swatches.closest( '.product' );
2257		/* add variation id */
2258		$swatches.attr( 'data-variation_id', variation.variation_id );
2259
2260		/* update image */
2261		self.variationsImageUpdate( variation, $product );
2262		
2263	}
2264
2265	/**
2266	 * Stores a default attribute for an element so it can be reset later
2267	 */
2268	themejr.setVariationAttr = function ( $el, attr, value ) {
2269		if ( undefined === $el.attr( 'data-o_' + attr ) ) {
2270			$el.attr( 'data-o_' + attr, (
2271				!$el.attr( attr )
2272			) ? '' : $el.attr( attr ) );
2273		}
2274		if ( false === value ) {
2275			$el.removeAttr( attr );
2276		}
2277		else {
2278			$el.attr( attr, value );
2279		}
2280	}
2281
2282	/**
2283	 * Reset a default attribute for an element so it can be reset later
2284	 */
2285	themejr.resetVariationAttr = function ( $el, attr ) {
2286		if ( undefined !== $el.attr( 'data-o_' + attr ) ) {
2287			$el.attr( attr, $el.attr( 'data-o_' + attr ) );
2288		}
2289	}
2290
2291	themejr.variationsImageUpdate = function ( variation, $product ) {
2292
2293		var self = this,
2294			$product_img = $product.find( 'img.front-image' );
2295		
2296		if ( variation && variation.image_src && variation.image.src && variation.image_src.length > 1 ) {			
2297			self.setVariationAttr( $product_img, 'src',
2298				variation.image_src[ 0 ] );
2299			self.setVariationAttr( $product_img, 'srcset',
2300				variation.image_srcset );
2301			self.setVariationAttr( $product_img, 'sizes',
2302				variation.image_sizes );
2303		} else {
2304			self.resetVariationAttr( $product_img, 'src' );
2305			self.resetVariationAttr( $product_img, 'srcset' );
2306			self.resetVariationAttr( $product_img, 'sizes' );
2307		}
2308
2309	}
2310	
2311	themejr.initAjaxLoad = function(){ 
2312		var button = $( '.themejr-ajax-load' );
2313
2314		button.each( function( i, val ) {
2315			var _option = $( this ).data();
2316			
2317			if ( _option !== undefined ) {
2318				var page      = _option.total_page,
2319					container = _option.container,
2320					container_element = _option.container_element,
2321					layout    = _option.layout,
2322					load_more_label    = _option.load_more_label,
2323					loading_finished_msg    = _option.loading_finished_msg,
2324					loading_msg    = themejr_options.js_translate_text.loading_txt,					
2325					isLoading = false,
2326					anchor    = $( val ).find( 'a' ),
2327					next      = $( anchor ).attr( 'href' ),
2328					i         = 2;
2329
2330				if ( layout == 'load-more-button' ) {
2331					$( val ).on( 'click', 'a', function( e ) {
2332						e.preventDefault();
2333						anchor = $( val ).find( 'a' );
2334						next   = $( anchor ).attr( 'href' );
2335
2336						$( anchor ).addClass('active-loading').text(loading_msg);
2337						
2338						getData();
2339					});
2340				}  else if( layout == 'infinity-scroll' ) {
2341					var waiting = false,
2342						endScrollHandle;
2343						themejr.$window.on('scroll', function () {
2344							
2345							if (themejr.$body.find('.infinity-scroll').is(':in-viewport')) {
2346								
2347								themejr.$body.find('.infinity-scroll a').trigger('click');
2348							}
2349						}).trigger('scroll');
2350						
2351						themejr.$body.on('click', '.themejr-pagination a.button', function (e) {
2352							if ( waiting ) {
2353								return;
2354							}
2355							waiting = true;
2356							e.preventDefault();
2357							
2358							var $el = $(this);
2359							$el.addClass('active-loading').text(loading_msg);
2360							if ($el.data('requestRunning')) {
2361								return;
2362							}
2363
2364							$el.data('requestRunning', true);
2365
2366							var $pagination = $el.closest('.themejr-pagination'),								
2367								container = _option.container,
2368								container_element = _option.container_element,
2369								$products = $pagination.prev('.'+container),
2370								href = $el.attr('href');
2371							
2372							
2373							$.get(
2374								href,
2375								function (response) {
2376									
2377									var content = $(response).find('#primary .'+ container).children('.'+container_element),
2378										$pagination_html = $(response).find('.themejr-pagination').html();
2379
2380									$pagination.html($pagination_html);
2381
2382									if ($('.masonry-grid').length > 0) {
2383							
2384										$products.append(content).isotope( 'appended', content );
2385										$products.imagesLoaded().progress(function() {
2386											$products.isotope('layout');
2387										});
2388									
2389									}else{
2390										$products.append(content);
2391									}
2392						
2393									$pagination.find('a').data('requestRunning', false);
2394									waiting = false;
2395									themejr.initMagnaficPopup();
2396									/* themejr.priceSlider(); */
2397									themejr.themejrElementorSwiperSlider();
2398									themejr.tooltip();
2399									themejr.imagelazyload();
2400									themejr.widgetToggle();
2401									themejr.widgetMenuToggle();
2402									themejr.widgetMaxLimitItem();
2403									themejr.canvasSidebar();
2404									themejr.stickySidebar();
2405									themejr.ProductLoopQuantityField();
2406									themejr.productQuickView();
2407									themejr.addToCompare();
2408									$(document.body).trigger('themejr_shop_ajax_loading_end');
2409								}
2410							);
2411						});
2412				} 
2413				var getData = function() {
2414					$.get( next + '', function( data ) {
2415						var content    = $( '.' + container, data ).wrapInner( '' ).html(),
2416							newElement = $( '.' + container, data ).find( '.' + container_element );
2417						next = $( anchor, data ).attr( 'href' );
2418						if ($('.masonry-grid').length > 0) {
2419							
2420							$( '.'+ container ).append(newElement).isotope( 'appended', newElement );
2421						$( '.'+ container ).imagesLoaded().progress(function() {
2422							$( '.'+ container ).isotope('layout');
2423						});
2424						
2425						}else{
2426							$( '.' + container ).append(newElement);
2427						}
2428						$( anchor ).removeClass('active-loading').text( load_more_label );
2429
2430						if ( page > i ) {
2431							if ( themejr_options.permalink == 'plain' ) {
2432								var link = next.replace( /paged=+[0-9]+/gi, 'paged=' + ( i + 1 ) );
2433							} else {
2434								var link = next.replace( /page\/+[0-9]+\//gi, 'page/' + ( i + 1 ) + '/' );
2435							}
2436
2437							$( anchor ).attr( 'href', link );
2438						} else {
2439							$( anchor ).text( loading_finished_msg );
2440							$( anchor ).attr( 'href', 'javascript:void(0);' ).addClass( 'disabled' );
2441						}
2442						isLoading = false;
2443						i++;
2444						themejr.initMagnaficPopup();
2445						themejr.themejrElementorSwiperSlider();
2446						themejr.tooltip();
2447						themejr.imagelazyload();
2448						themejr.widgetToggle();
2449						themejr.widgetMenuToggle();
2450						themejr.widgetMaxLimitItem();
2451						themejr.canvasSidebar();
2452						themejr.stickySidebar();
2453						themejr.ProductLoopQuantityField();
2454						themejr.productQuickView();
2455						themejr.addToCompare();
2456						$(document).trigger('yith_wcwl_reload_fragments'); /* Fixed wishlist icon afer ajax*/
2457						$(document.body).trigger('themejr_shop_ajax_loading_end');
2458					});
2459				}
2460			}
2461		});
2462	}
2463	
2464	themejr.loadmoreProducts = function(){
2465		var load_more_products_button = $('.themejr-products-load-more');
2466		$('.themejr-products-load-more .themejr-load-more').on('click',function(){
2467			
2468			var load_more_btn = $(this);
2469			var page = parseInt(load_more_btn.parent().attr('data-page'));
2470			var data_attr = load_more_btn.parent().data();
2471			var	atts = data_attr.attribute;
2472			var post_wrap = load_more_btn.closest('.themejr-element').find('.products-wrap');
2473            var wrap_id = load_more_btn.closest('.themejr-element').attr('id');
2474			var data = {
2475				action: 'themejr_loadmore_product',
2476				nonce: themejr_options.nonce,
2477				attr: atts,
2478				page: page,
2479			};
2480			if(load_more_btn.hasClass('loading')){ return false;}
2481			themejr.loadAjaxPost(load_more_btn,data,post_wrap,wrap_id);
2482		});
2483		var animationFrame = function () {
2484			$('.themejr-products-load-more a.infinity-scroll').each(function (i, val) {
2485				var load_more_btn = $(this);
2486				var page = parseInt(load_more_btn.parent().attr('data-page'));
2487				var atts = load_more_btn.parent().attr('data-attribute');
2488				var post_wrap = load_more_btn.closest('.themejr-element').find('.products-wrap');
2489				var wrap_id = load_more_btn.closest('.themejr-element').attr('id');
2490				var bottomOffset = post_wrap.offset().top + post_wrap.height() - $(window).scrollTop();
2491				if (bottomOffset < window.innerHeight && bottomOffset > 0) {
2492					
2493					var page = parseInt(load_more_btn.parent().attr('data-page'));
2494					if(!load_more_btn.hasClass('themejr-loadmore-disabled')){ 
2495						if(!themejr.isPostLoading){
2496							themejr.isPostLoading = true;
2497							load_more_btn.trigger('click');
2498						}
2499					}
2500				}
2501			});
2502		}
2503		
2504		var scrollHandler = function () {
2505			requestAnimationFrame(animationFrame);
2506		};                    
2507		$(window).scroll(scrollHandler);		
2508	}
2509	
2510	themejr.loadAjaxPost = function( btn, data, element_wrap, parantElement ){
2511		var load_more_label = btn.parent().data('load_more_label');
2512		var loading_finished_msg = btn.parent().data('loading_finished_msg');
2513		var label_txt = '';
2514		btn.addClass('process');
2515		if(btn.hasClass('themejr-loadmore-disabled')){
2516			return;
2517		}
2518		btn.html('<span class="loading"> '+themejr_options.js_translate_text.loading_txt+'</span>');
2519		$.ajax({
2520			url: themejr_options.ajax_url,
2521			data: data,
2522			dataType: 'json',
2523			method: 'POST',
2524			success: function(response) {
2525				var items = $('' + response['html'] + '');
2526				if ($.trim(response['success']) == 'ok') {
2527					if ($('.masonry-grid').length > 0) {
2528												
2529						 setTimeout(function () {
2530						  element_wrap.imagesLoaded().masonry().append(items).masonry( 'appended', items).masonry('layout');
2531						 }, 500);
2532						 
2533						 
2534					}else{
2535						element_wrap.append(items);
2536					}
2537					
2538					if ($.trim(response['show_bt']) == '0') {
2539						$('#' +parantElement + ' .themejr-load-more').addClass('disabled themejr-loadmore-disabled').html(loading_finished_msg);
2540					} else {
2541						$('#' +parantElement + ' .themejr-load-more').parent().attr('data-page', data['page'] + 1);
2542						btn.html(load_more_label);
2543					}
2544				}
2545			},
2546			error: function(data) {
2547				console.log('ajax error');
2548			},
2549			complete: function() {
2550				themejr.isPostLoading = false;
2551				themejr.imagelazyload();
2552				themejr.initMagnaficPopup();
2553				themejr.swatchInLoop();
2554				themejr.ProductLoopQuantityField();
2555				themejr.tooltip();
2556				themejr.productQuickView();
2557				themejr.productSaleCountdown();
2558				btn.removeClass('process');
2559			},
2560		});
2561	}
2562	
2563	themejr.tooltip = function () {
2564		
2565		if ( ! themejr_options.product_tooltip ) { return; }
2566		
2567		var tooltip_left = ('.product-style-1:not(.list-view) .themejr-whishlist-button a,.product-style-1:not(.list-view) .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistaddedbrowse a,.product-style-1:not(.list-view) .themejr-compare-button a,.product-style-1:not(.list-view) .themejr-quickview-button a,.product-style-3:not(.list-view) .themejr-whishlist-button a,.product-style-3:not(.list-view) .yith-wcwl-add-to-wis
2567hlist .yith-wcwl-wishlistaddedbrowse a,.product-style-3:not(.list-view) .themejr-compare-button a,.product-style-3:not(.list-view) .themejr-quickview-button a');
2568		/* Bootstrap tooltips */
2569		$(tooltip_left).tooltip({
2570			animation: false,
2571			container: 'body',
2572			trigger : 'hover',
2573			placement : !themejr.isCheckRTL() ? 'left':'right',
2574			title: function() {
2575				return $(this).text();
2576			}
2577		});
2578		
2579		$('.product-style-2:not(.list-view) .themejr-whishlist-button a,.product-style-2:not(.list-view) .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistaddedbrowse a,.product-style-2:not(.list-view) .themejr-compare-button a,.product-style-2:not(.list-view) .themejr-quickview-button a,.product-style-2:not(.list-view) .themejr-product-buttons .themejr-cart-button,.product-style-4:not(.list-view) .themejr-whishlist-button a,.product-style-4:not(.list-view) .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistaddedbrowse a,.list-view .themejr-whishlist-button a,.product-style-2:not(.list-view) .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistaddedbrowse a,.list-view .themejr-compare-button a,.list-view .themejr-quickview-button a, .themejr-tooltip').tooltip({
2580			animation: false,
2581			container: 'body',
2582			trigger : 'hover',
2583			title: function() {
2584				if( $(this).find('.added_to_cart').length > 0 ) {
2585					return $(this).find('.add_to_cart_button').text();
2586				}
2587				return $(this).text();
2588			}
2589		});
2590		
2591	}
2592	
2593	themejr.productGallerySummarySticky = function () {
2594		/*
2595		* Single Product Gallary & Summary Sticky
2596		*/
2597		if ( $( window ).width() <= 767 || ( ! $('.themejr-product-sticky').length > 0 ) || 'undefined' === typeof ($.fn.stick_in_parent) ) {
2598			return;
2599		}
2600		
2601		var $wrapper 	= $( '.themejr-product-sticky' );
2602		var $gallery 	= $wrapper.find( '.woocommerce-product-gallery' );
2603		var $summary 	= $wrapper.find( '.entry-summary' );
2604		var offset 		= 50;
2605		
2606		if ( 0 === $wrapper.length ) {
2607			return;
2608		}
2609		
2610		setTimeout(function () {
2611			if( themejr_options.sticky_product_image || themejr_options.sticky_product_summary ){
2612				if ( $summary.outerHeight() < $gallery.outerHeight() ) {
2613					stickySummary();
2614				} else {
2615					stickyGallery();
2616				}
2617						
2618				$( window ).resize( function() {
2619					if ( $( window ).width() <= 767 ) {
2620						$gallery.trigger('sticky_kit:detach');
2621						$summary.trigger('sticky_kit:detach');
2622					}else{
2623						if ($summary.outerHeight() < $gallery.outerHeight()) {
2624							stickySummary();
2625						} else {
2626							stickyGallery();
2627						}
2628					}
2629				});
2630			}
2631		}, 100);
2632		
2633		function stickyGallery(){
2634			
2635			if( ! themejr_options.sticky_product_image ) { return; }
2636			
2637			$gallery.stick_in_parent({
2638				offset_top  : offset,
2639				sticky_class: 'themejr-is-stucked'
2640			});
2641		}
2642		
2643		function stickySummary(){
2644			
2645			if( ! themejr_options.sticky_product_summary ){ return; }
2646			
2647			$summary.stick_in_parent({
2648				offset_top  : offset,
2649				sticky_class: 'themejr-is-stucked'
2650			});
2651		}
2652	}
2653	
2654	themejr.productGallerySlider = function() {
2655		/*
2656		 * Product Gallery  & Thumnails slider
2657		 */
2658		if ( ! $.isFunction($.fn.slick) ) {
2659			return;
2660		}
2661		
2662		/* Product Gallery Slider */
2663		if( $('.woocommerce-product-gallery').find( '.single-product-gallery' ).length > 0 ) {
2664			$( '.single-product-gallery' ).not( '.slick-initialized' ).slick({
2665				slidesToShow	: ( 'product-gallery-horizontal' == themejr_options.product_gallery_style ) ? 3 : 1,
2666				slidesToScroll	: 1,
2667				asNavFor		: ( 'product-gallery-left' == themejr_options.product_gallery_style || 'product-gallery-right' == themejr_options.product_gallery_style || 'product-gallery-bottom' == themejr_options.product_gallery_style ) ? '.single-product-thumbnails' : '',
2668				fade			: ( 'product-gallery-left' == themejr_options.product_gallery_style || 'product-gallery-right' == themejr_options.product_gallery_style || 'product-gallery-bottom' == themejr_options.product_gallery_style ) ? true : false,
2669				infinite 		: false,
2670				adaptiveHeight	: true,
2671				rtl				: ( themejr.isCheckRTL() ) ? true : false,
2672				responsive		:[
2673					{
2674						breakpoint	: 639,
2675						settings	: {
2676							slidesToShow 	: 1,
2677							dots 			: true
2678						}
2679					}
2680				]
2681			});
2682		}
2683		
2684		/* Product Thumbnails Silder */
2685		if( $('.woocommerce-product-gallery').find( '.single-product-thumbnails' ).length > 0 ) {
2686			$( '.single-product-thumbnails' ).not( '.slick-initialized' ).slick({
2687				slidesToShow	: 4,
2688				slidesToScroll	: 1,
2689				asNavFor		: '.single-product-gallery',
2690				infinite 		: false,
2691				arrows			: true,
2692				focusOnSelect	: true,
2693				vertical		: ( 'product-gallery-left' == themejr_options.product_gallery_style || 'product-gallery-right' == themejr_options.product_gallery_style ) ? true : false,			
2694				rtl				: ( 'product-gallery-bottom' == themejr_options.product_gallery_style && themejr.isCheckRTL() ) ? true : false,
2695				responsive		:[
2696					{
2697						breakpoint	: 639,
2698						settings	: {
2699							slidesToShow 	: 4,
2700							infinite 		: false,
2701							vertical		: false,
2702							rtl				: ( themejr.isCheckRTL() ) ? true : false,
2703						}
2704					}
2705				]
2706			});
2707		}
2708					
2709		/* Reset the index of image on product variation */
2710		$(document).on( 'found_variation', '.variations_form', function( es, variation ) {		
2711			if ( variation && variation.image && variation.image.src && variation.image.src.length > 1 ) {
2712				$( '.single-product-gallery, .single-product-thumbnails' ).slick( 'slickGoTo', 0 );
2713				setTimeout(function () {
2714					var $product_img = $(document).find( '.themejr-quick-view .woocommerce-product-gallery__wrapper  .slick-current.slick-active img' );
2715					themejr.setVariationAttr( $product_img, 'src',
2716					variation.image.src );
2717					themejr.setVariationAttr( $product_img, 'srcset',
2718					variation.image.srcset );
2719					themejr.setVariationAttr( $product_img, 'sizes',
2720					variation.image.sizes );
2721				}, 300);
2722			}
2723		}).on('reset_image', function () {
2724			$( '.single-product-gallery, .single-product-thumbnails').slick( 'slickGoTo', 0 );
2725			setTimeout(function () {
2726				var $product_img = $(document).find( '.themejr-quick-view .woocommerce-product-gallery__wrapper  .slick-current.slick-active img' );
2727				themejr.resetVariationAttr( $product_img, 'src' );
2728				themejr.resetVariationAttr( $product_img, 'srcset' );
2729				themejr.resetVariationAttr( $product_img, 'sizes' );
2730			}, 300);
2731		});
2732	};
2733	
2734	themejr.productImageZoom = function(){
2735		/*
2736		 * Single Product image zoom
2737		 */
2738		if ( themejr_options.product_image_zoom ) {
2739			var $wc_gallery = $( '.woocommerce-product-gallery' ),
2740			    zoomTarget = $wc_gallery.find( '.woocommerce-product-gallery__image > a' ),
2741				width 		= zoomTarget.children('img').attr( 'data-large_image_width' ),
2742				/* zoom option */
2743				zoom_options = $.extend( {
2744					touch: false
2745				});
2746				
2747			/* On Click Zoom */
2748			if ('ontouchstart' in document.documentElement) {
2749				zoom_options.on = 'click';
2750			}			
2751			
2752			setTimeout(function () {
2753				zoomTarget.parent().trigger('zoom.destroy').children('.zoomImg').remove();
2754			}, 500);			
2755			
2756			/* Zoom */
2757			if ( 'undefined' != typeof width && zoomTarget.width() < width ) {
2758				zoomTarget.trigger( 'zoom.destroy' );
2759				zoomTarget.zoom(zoom_options);
2760				
2761				/* show zoom on hover */
2762				zoomTarget.find(':hover').length && zoomTarget.trigger('mouseover');
2763			}
2764		}
2765	};
2766	
2767	themejr.productPhotoSwipe = function () {
2768		/*
2769		 * Single Product Photo Swipe
2770		 */
2771		if ( themejr_options.product_PhotoSwipe ) {
2772			if( $( '.woocommerce-product-gallery' ).length === 0 ){
2773				return;
2774			}
2775			/* var self = this; */
2776			var $wc_gallery = $( '.woocommerce-product-gallery' );	
2777			
2778			/* If woocommmerce product gallery is undefined, create it */
2779			typeof $wc_gallery.data('product_gallery') == 'undefined' && $wc_gallery.wc_product_gallery();
2780			this.$wc_gallery = $wc_gallery;
2781			this.wc_gallery = $wc_gallery.data('product_gallery');
2782		
2783			/* Remove woocommerce zoom triggers */
2784			$wc_gallery.children('.woocommerce-product-gallery__trigger').remove();
2785			
2786			/* Prevent going to image link */
2787			$wc_gallery
2788				.off('click', '.woocommerce-product-gallery__image a')
2789				.on('click', themejr.preventDefault);
2790							
2791			$wc_gallery.on('click', '.woocommerce-product-gallery__image a', this.openPhotoswipe.bind(this));
2792			$wc_gallery.on('click', '.themejr-product-image-full', this.openPhotoswipe.bind(this));	
2793		}else{
2794			$('.woocommerce-product-gallery__image a').on('click', function(e){
2795				e.preventDefault();
2796			});			
2797		}		
2798	};
2799	
2800	themejr.openPhotoswipe = function (e) {
2801		if (wc_single_product_params.photoswipe_options) {	
2802			/* Slick slider index */
2803			var slider = this.$wc_gallery.find('.single-product-gallery').slick("getSlick");
2804			if (slider) {
2805				wc_single_product_params.photoswipe_options.index = slider.currentSlide;
2806			}		
2807
2808			this.wc_gallery.openPhotoswipe(e);			
2809			e.stopPropagation();	
2810		}
2811	}
2812	
2813	themejr.productSaleCountdown = function() {
2814		/*
2815		 * Product Sale CountDown
2816		 */
2817		
2818		$('.product-countdown,.themejr-countdown-timer').each(function(){
2819			
2820			var $this 	= $(this),
2821				template 	= '',
2822				end_date = $this.data('end-date');			
2823			
2824			template = '<span class="days">%-D<span>'+themejr_options.js_translate_text.days_text+'</span></span><span class="hour">%H<span>'+themejr_options.js_translate_text.hours_text+'</span></span><span class="minute">%M<span>'+themejr_options.js_translate_text.mins_text+'</span></span><span class="second">%S<span>
2824'+themejr_options.js_translate_text.secs_text+'</span></span>';				
2825			
2826			if ( typeof ( $.fn.countdown ) != 'undefined' ) {
2827				/* initialize  */
2828				$this.countdown( end_date, function(event) {
2829					 $(this).html(event.strftime(template));
2830				});
2831			}
2832		});
2833	};
2834	
2835	themejr.productReviewLink = function() {
2836		/*
2837		 * Scroll Show Product Review Tab
2838		 */
2839		
2840		$('.woocommerce-product-rating .rating-counts').on('click', function (e) {
2841			$('.woocommerce-review-link').trigger('click');
2842			 var tabpanel = '#tab-title-reviews';
2843			 $('html,body').animate({scrollTop:$(tabpanel).offset().top-100}, 750);
2844		});
2845	};
2846		
2847	themejr.getProductSizeChart = function () {
2848		/*
2849		 * Get Product Size Chart
2850		 */	
2851		$('.themejr-ajax-size-chart').on('click', function (e) {
2852			e.preventDefault();
2853			 var id = $(this).data('id'); /* get post value */
2854			 var data = {
2855				action			: 'themejr_ajax_get_size_chart',
2856				'id'			: id,
2857				nonce   		: themejr_options.nonce,
2858			};
2859			var chart_btn = $(this);
2860			if(chart_btn.hasClass('loading')){
2861				return false;
2862			}
2863			chart_btn.addClass('loading');
2864			$.ajax({
2865				type: 'post',
2866				url: themejr_options.ajax_url,
2867				data: data,
2868				beforeSend: function (response) {
2869					
2870				},
2871				complete: function (response) {
2872					chart_btn.removeClass('loading');
2873				},
2874				success: function (response) {
2875					$(this).magnificPopup({
2876						removalDelay: 500,
2877						items: {
2878							src: response,
2879							type: 'inline'
2880						},
2881						callbacks: {
2882							open: function () {
2883								var popupWrap = $( '.themejr-product-sizechart' );
2884								popupWrap.addClass('animated fadeInLeft');						
2885							},							
2886							beforeClose: function() {
2887								var popupWrap = $( '.themejr-product-sizechart' );
2888								popupWrap.removeClass('fadeInLeft').addClass('fadeOutRight');
2889							}, 
2890							close: function() {
2891								var popupWrap = $( '.themejr-product-sizechart' );
2892								popupWrap.removeClass('animated fadeOutRight');
2893								
2894							}
2895						},
2896					}).magnificPopup('open');
2897				},
2898			});
2899			
2900      });
2901	}
2902	
2903	themejr.getAjaxBlock = function () {
2904		/*
2905		 * Get Product Size Chart
2906		 */	
2907		$('.themejr-ajax-block').on('click', function (e) {
2908			e.preventDefault();
2909			 var id = $(this).data('id'); /* get block value */
2910			 var title = $(this).data('title'); /* title */
2911			 var data = {
2912				action			: 'themejr_ajax_get_block',
2913				'id'			: id,
2914				'title'			: title,
2915				nonce   		: themejr_options.nonce,
2916			};
2917			var chart_btn = $(this);
2918			if(chart_btn.hasClass('loading')){
2919				return false;
2920			}
2921			chart_btn.addClass('loading');
2922			$.ajax({
2923				type: 'post',
2924				url: themejr_options.ajax_url,
2925				data: data,
2926				beforeSend: function (response) {
2927					
2928				},
2929				complete: function (response) {
2930					chart_btn.removeClass('loading');
2931				},
2932				success: function (response) {
2933					$(this).magnificPopup({
2934						removalDelay: 500,
2935						items: {
2936							src: response,
2937							type: 'inline'
2938						},
2939						callbacks: {
2940							open: function () {
2941								var popupWrap = $( '.themejr-ajax-blok-content' );
2942								popupWrap.addClass('animated slideInDown');						
2943							},							
2944							beforeClose: function() {
2945								var popupWrap = $( '.themejr-ajax-blok-content' );
2946								popupWrap.removeClass('slideInDown').addClass('slideOutUp');
2947							}, 
2948							close: function() {
2949								var popupWrap = $( '.themejr-ajax-blok-content' );
2950								popupWrap.removeClass('animated slideOutUp');
2951								
2952							}
2953						},
2954					}).magnificPopup('open');
2955				},
2956			});
2957			
2958      });
2959	}
2960	
2961	themejr.productQuantityPlusMinus = function() {
2962		/*
2963		 * Product Quantity Plus/Minus
2964		 */
2965		$( document ).on( 'click', '.quantity .plus, .quantity .minus', function() {
2966            /* Get values */
2967            var $qty        = $( this ).closest( '.quantity' ).find( '.qty'),
2968                currentVal  = parseFloat( $qty.val() ),
2969                max         = parseFloat( $qty.attr( 'max' ) ),
2970                min         = parseFloat( $qty.attr( 'min' ) ),
2971                step        = $qty.attr( 'step' );
2972
2973            /* Format values */
2974            if ( ! currentVal || currentVal === '' || currentVal === 'NaN' ) currentVal = 0;
2975            if ( max === '' || max === 'NaN' ) max = '';
2976            if ( min === '' || min === 'NaN' ) min = 0;
2977            if ( step === 'any' || step === '' || step === undefined || parseFloat( step ) 
2977=== 'NaN' ) step = '1';
2978
2979            /* Change the value */
2980            if ( $( this ).is( '.plus' ) ) {
2981                if ( max && ( max == currentVal || currentVal > max ) ) {
2982                    $qty.val( max );
2983                } else {
2984                    $qty.val( currentVal + parseFloat( step ) );
2985                }
2986            } else {
2987                if ( min && ( min == currentVal || currentVal < min ) ) {
2988                    $qty.val( min );
2989                } else if ( currentVal > 0 ) {
2990                    $qty.val( currentVal - parseFloat( step ) );
2991                }
2992            }
2993
2994            /* Trigger change event */
2995            $qty.trigger( 'change' );
2996        });
2997	};
2998	
2999	themejr.productQuickShop = function () {
3000		/*
3001		 * Product Buy Now Button click
3002		 */
3003		$('body').on('click', '.themejr_quick_buy_button', function() {
3004			
3005			var $this		= $(this),
3006			product_id		= $(this).attr('data-themejr-product-id'),
3007			product_type	= $(this).attr('data-product-type'),
3008			selected 		= $(this).closest('form.cart').find( 'input.themejr_quick_buy_product_' + product_id ),
3009			productform 	= selected.parent(),			
3010			submit_btn 		= productform.find('[type="submit"]'),
3011			is_disabled 	= submit_btn.is(':disabled');
3012			
3013			if(!$(this).closest('.woocommerce-variation-add-to-cart').hasClass('woocommerce-variation-add-to-cart-disabled')){
3014				$this.addClass('loading');
3015			}else{
3016				is_disabled = true;
3017			}
3018			
3019			if ( is_disabled ) {
3020				$('html, body').animate({
3021					scrollTop: submit_btn.offset().top - 200
3022				}, 900);
3023			} else {
3024				if(!$this.hasClass('disable')){
3025					productform.append('<input type="hidden" value="true" name="themejr_quick_buy" />');
3026				}
3027				if ( themejr_options.enable_add_to_cart_ajax ) {
3028					$('.single_add_to_cart_button').addClass('quick-buy-proceed');
3029				}
3030				productform.find('.single_add_to_cart_button').trigger('click');
3031			} 
3032		});
3033		
3034		$('form.cart').change(function () {
3035			var is_submit_disabled = $(this).find('[type="submit"]').is(':disabled');
3036			if ( is_submit_disabled ) {
3037				$('.themejr_quick_buy_button').attr('disabled', 'disable');
3038			} else {
3039				$('.themejr_quick_buy_button').removeAttr('disabled');
3040			}
3041		});
3042	}
3043	
3044	themejr.productBoughtTogetherInit = function(){ 
3045		/* Procut Bought Together */
3046		
3047		if ( themejr.$body.find('.themejr-bought-together-products').length === 0 ) {
3048			return;
3049		}
3050		
3051		var self = this;
3052		/* check box click */
3053		$('body').on('click', '.themejr-bought-together-products .product-checkbox input[type=checkbox]', function() {
3054			if ($(this).is(":checked")) {
3055				$(this).closest('.themejr-product-inner').removeClass('themejr-disable-product');				
3056			}else{
3057				$(this).closest('.themejr-product-inner').addClass('themejr-disable-product');
3058			}
3059			self.productBoughtTogetherChangeEvent();
3060		});
3061		/* check all */
3062		self.productBoughtTogetherCheckAllItems();
3063		/* add to cart */
3064		self.productBoughtTogetherAddToCart();
3065		
3066		$( 'body' ).on( 'found_variation', function( event, variation ) {
3067			$('.themejr-bought-together-products .current-item .item-price').each(function() {				
3068				if( $(this).data( 'type' ) == 'variable' ) {
3069					$(this).data( 'itemprice', variation.display_price );
3070					$(this).html(self.themejr_woo_formated_price(variation.display_price));
3071					self.productBoughtTogetherChangeEvent();
3072				}
3073			});
3074		});
3075	}
3076	themejr.productBoughtTogetherChangeEvent = function() {
3077		var self = this;
3078		$('.add-items-to-cart').addClass('loading');
3079		
3080		var total_price = self.product_bought_together_get_total_price();
3081		var addon_total_price = self.product_addons_get_total_price();
3082		var total_addon = self.product_bought_together_product_count();
3083		if(total_addon){
3084			$('.add-items-to-cart').removeAttr("disabled");
3085		}else{
3086			$('.add-items-to-cart').attr("disabled", true);
3087		}
3088		$( '.addons-item .addon-count' ).html( total_addon );
3089				$( '.addons-item span.items-price' ).html( self.themejr_woo_formated_price(addon_total_price) );
3090				$( '.items-total span.total-price' ).html( self.themejr_woo_formated_price(total_price) );
3091		$('.add-items-to-cart').removeClass('loading');
3092	}
3093	
3094	themejr.themejr_woo_formated_price = function(number){
3095		var self = this;
3096		return self.themejr_formated_price(number, themejr_options.price_thousand_separator,
3097		themejr_options.price_decimal_separator, themejr_options.price_decimals, 
3098		themejr_options.currency_symbol,themejr_options.price_format);
3099	}
3100	
3101	themejr.themejr_formated_price = function(number, thousand_sep, decimal_sep, tofixed, symbol, woo_price_format){
3102		  var before_text = '';
3103        var after_text = '';
3104        number = number || 0;
3105        tofixed = !isNaN(tofixed = Math.abs(tofixed)) ? tofixed : 2;
3106        symbol = symbol !== undefined ? symbol : "$";
3107        thousand_sep = thousand_sep || ",";
3108        decimal_sep = decimal_sep || ".";
3109        var negative = number < 0 ? "-" : "",
3110            i = parseInt(number = Math.abs(+number || 0).toFixed(tofixed), 10) + "",
3111            j = (j = i.length) > 3 ? j % 3 : 0;
3112        
3113        symbol = '<span class="woocommerce-Price-currencySymbol">' + symbol + '</span>';
3114        
3115        switch (woo_price_format) {
3116            case '%1$s%2$s':
3117                /* left */
3118                before_text += symbol;
3119                break;
3120            case '%1$s %2$s':
3121                /* left with space */
3122                before_text += symbol + ' ';
3123                break;
3124            case '%2$s%1$s':
3125                /* right */
3126                after_text += symbol;
3127                break;
3128            case '%2$s %1$s':
3129                /* right with space */
3130                after_text += ' ' + symbol;
3131                break;
3132            default:
3133                /* default */
3134                before_text += symbol;
3135        }       
3136        
3137        var woo_price_return = before_text +
3138            negative + (j ? i.substr(0, j) + thousand_sep : "" ) +
3139            i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousand_sep) +
3140            (tofixed ? decimal_sep + Math.abs(number - i).toFixed(tofixed).slice(2) : "") +
3141            after_text;
3142        
3143        woo_price_return = '<span class="woocommerce-Price-amount amount">' + woo_price_return + '</span>';
3144        
3145        return woo_price_return;
3146	}
3147	
3148	themejr.productBoughtTogetherCheckAllItems = function(){
3149		var self = this;
3150		$('body').on('click', '.check-all-items', function(){
3151			$('.themejr-together-product:checkbox').not(this).prop('checked', this.checked);
3152			if ($(this).is(":checked")) {
3153				$('.themejr-together-product:checkbox').prop('checked', true);  
3154			} else {
3155				$('.themejr-together-product:checkbox').prop("checked", false);
3156			}
3157
3158			self.productBoughtTogetherChangeEvent();
3159		});
3160	}
3161	
3162	themejr.BoughtTogetherIsVariationProduct = function(){
3163		
3164		var product_type = $('.themejr-bought-together-products .current-item .item-price').data('type');
3165		if( product_type == 'variable'){
3166			return true
3167		}
3168		return false;
3169	}
3170	
3171	themejr.BoughtTogetherCurrentProductid = function(){
3172				
3173		var product_id = $('.themejr-bought-together-products .current-item .item-price').data('id');
3174		
3175		return 	product_id;
3176	}
3177	
3178	themejr.BoughtTogetherVariationAvailable = function(){
3179		if( $(".single_add_to_cart_button").length === 0 || $(".single_add_to_cart_button").hasClass("disabled") || $(".single_add_to_cart_button").hasClass("wc-variation-is-unavailable") ) {
3180			return false;
3181		}
3182		return true;
3183	}
3184	
3185	themejr.productBoughtTogetherAddToCart = function(){
3186		var self = this;
3187		$('body').on('click', '.add-items-to-cart:not(.loading)', function(e){
3188			e.preventDefault();
3189			
3190			var is_variation_product = themejr.BoughtTogetherIsVariationProduct();
3191			var variation_product_id = themejr.BoughtTogetherCurrentProductid();
3192			
3193			if(is_variation_product && themejr.BoughtTogetherVariationAvailable() === false){
3194				alert(themejr_options.js_translate_text.variation_unavailable);
3195				return;
3196			}
3197			
3198			var self_this = $(this);
3199			self_this.addClass('loading');
3200			
3201			var all_product_ids = self.product_bought_together_get_checked_product_ids();
3202			var msg='';
3203			if( all_product_ids.length === 0 ) {
3204				msg = themejr_options.bought_together_error;
3205			} else {
3206				
3207				setTimeout(function () {
3208					for (var i = 0; i < all_product_ids.length; i++ ) {
3209						if( is_variation_product && all_product_ids[i] == variation_product_id ){							
3210							var variation_id  = $('.variations_form .variations_button').find('input[name^=variation_id]').val();
3211							var variation = {};
3212							if( $( '.variations_form' ).find('select[name^=attribute]').length ) {
3213								$( '.variations_form' ).find('select[name^=attribute]').each(function() {
3214									var attribute = $(this).attr("name");
3215									var attributevalue = $(this).val();
3216									variation[attribute] = attributevalue;
3217								});
3218							} else {
3219
3220								$( '.variations_form' ).find('.select').each(function() {
3221									var attribute = $(this).attr("data-attribute-name");
3222									var attributevalue = $(this).find('.selected').attr('data-name');
3223									variation[attribute] = attributevalue;
3224								});
3225
3226							}
3227							$.ajax({
3228								type: "POST",
3229								async: false,
3230								url: themejr_options.ajax_url,
3231								data: {
3232									'product_id': all_product_ids[i],
3233									'variation_id': variation_id, 
3234									'variation': variation,
3235									'action': 'themejr_all_add_to_cart'
3236								},
3237								success : function( response ) {
3238									self.product_bought_together_refresh_fragments( response );
3239								}
3240							}); 
3241						} else {
3242							$.ajax({
3243								type: "POST",
3244								async: false,
3245								url: themejr_options.ajax_url,
3246								data: {
3247									'product_id': all_product_ids[i],
3248									'action': 'themejr_all_add_to_cart'
3249								},
3250								success : function( response ) {
3251									self.product_bought_together_refresh_fragments( response );
3252								}
3253							}); 
3254						}
3255					}
3256					var miniCartSidebar = $('.themejr-minicart-slide');
3257					var closeSidebar 	= $('.themejr-mask-overaly');
3258					if ( ! miniCartSidebar.hasClass('opened') ) {
3259						miniCartSidebar.addClass('opened');
3260						closeSidebar.addClass('opened');
3261						self.initNanoScroller();
3262					}
3263					self_this.removeClass('loading');
3264				}, 300); 
3265				
3266			}
3267			if(msg != ''){
3268				$( '.themejr-wc-message' ).html(msg).show(100);
3269				self_this.removeClass('loading');
3270				setTimeout(function () {
3271					$( '.themejr-wc-message' ).slideUp(500);
3272					
3273				}, 3000);				
3274			}
3275			
3276		});
3277	}
3278	
3279	themejr.product_bought_together_get_total_price = function(){
3280		var tprice = 0,itemprice =0;
3281		itemprice = $('.items-total-price .item-price').data('itemprice');
3282		tprice = parseFloat(itemprice);
3283		$('.themejr-bought-together-products .product-checkbox input[type=checkbox]').each(function() {
3284			if( $(this).is(':checked') ) {
3285				tprice += parseFloat( $(this).data( 'price' ) );
3286			}
3287		});
3288		return tprice;
3289	}
3290	themejr.product_addons_get_total_price = function(){
3291		var tprice = 0;
3292		
3293		$('.themejr-bought-together-products .product-checkbox input[type=checkbox]').each(function() {
3294			if( $(this).is(':checked') ) {
3295				tprice += parseFloat( $(this).data( 'price' ) );
3296			}
3297		});
3298		return tprice;
3299	}
3300	themejr.product_bought_together_product_count = function(){
3301		var pcount = 0;
3302		$('.themejr-bought-together-products .product-checkbox input[type=checkbox]').each(function() {
3303			if ($(this).is(':checked')) {
3304				pcount++;
3305			}
3306		});
3307		return pcount;
3308	}
3309	
3310	/* get checked product ids */
3311	themejr.product_bought_together_get_checked_product_ids = function(){
3312		var pids = [],pidd;
3313		pidd = $('.items-total-price .item-price').data('id');
3314		
3315		pids.push( pidd);
3316		$('.themejr-bought-together-products .product-checkbox input[type=checkbox]').each(function() {
3317			if( $(this).is(':checked') ) {
3318				pids.push( $(this).data( 'id' ) );
3319			}
3320		});
3321		return pids;
3322	}
3323	
3324	/* get checked product ids */
3325	themejr.product_bought_together_refresh_fragments = function(response){
3326		var frags = response.fragments;
3327
3328            /* Block fragments class */
3329            if ( frags ) {
3330                $.each( frags, function( key ) {
3331                    $( key ).addClass( 'updating' );
3332                });
3333            }
3334            if ( frags ) {
3335                $.each( frags, function( key, value ) {
3336                    $( key ).replaceWith( value );
3337                });
3338            }
3339	}
3340	
3341	themejr.wooProductTabsAccordian = function(){
3342		if( ( $('.woocommerce-tabs.accordion-layout').length > 0 ) || ( $('.woocommerce-tabs.tabs-layout').length > 0 ) ){
3343			
3344			var $accordion = $('.tab-content-wrap');
3345			var hash  = window.location.hash;
3346			var url   = window.location.href;
3347		
3348			if ( hash.toLowerCase().indexOf( 'comment-' ) >= 0 || hash === '#reviews' || hash === '#tab-reviews' ) {
3349				$accordion.find('.title-reviews').addClass('open');
3350			} else if ( url.indexOf( 'comment-page-' ) > 0 || url.indexOf( 'cpage=' ) > 0 ) {
3351				$accordion.find('.title-reviews').addClass('open');
3352			}else if ( hash === '#tab-additional_information' ) {
3353				$accordion.find('.title-additional_information').addClass('open');
3354			}  else {
3355				$accordion.find('.accordion-title').first().addClass('open');
3356			}
3357			$accordion.on('click', '.accordion-title', function( e ) {
3358				e.preventDefault();
3359				$(this).parent().siblings().find('.woocommerce-Tabs-panel').slideUp('fast');
3360				$(".accordion-title").not($(this)).removeClass("open");
3361				$(this).toggleClass("open").next().slideToggle('fast');
3362			});
3363			$(document).on('click', 'a.woocommerce-review-link', function(e) {
3364				$accordion.find('.accordion-title').removeClass("open");
3365				$accordion.find('.title-reviews').addClass("open");
3366			});
3367		}
3368	}
3369	
3370	themejr.wooProductTabsToggle = function(){
3371		if($('.woocommerce-tabs.toggle-layout').length > 0){
3372			var $accordion = $('.tab-content-wrap');
3373			
3374			$accordion.find('.accordion-title').addClass('open');
3375			$accordion.find('.woocommerce-Tabs-panel').css("display", "block");
3376			$accordion.on('click', '.accordion-title', function( e ) {
3377				e.preventDefault();				
3378				var accordion = $(this);
3379				var accordionContent = accordion.next('.woocommerce-Tabs-panel');				
3380				accordion.toggleClass("open");
3381				accordionContent.slideToggle(250);				
3382			});
3383			$(document).on('click', 'a.woocommerce-review-link', function(e) {
3384				e.stopPropagation();
3385			});
3386		}
3387	}
3388	
3389	themejr.wcfm_vendor = function(){
3390		//*******************************************************************
3391		//* WCFM Vendor
3392		//*******************************************************************/
3393		if ($('#_themejr_product_ids').length <= 0) {
3394            return false;
3395        }
3396        if (typeof $wcfm_product_select_args === 'undefined') {
3397            return false;
3398        }
3399
3400        $('#_themejr_product_ids').select2($wcfm_product_select_args);
3401	};
3402	
3403	themejr.MiniCartUpdateQuantity = function(){
3404		/* Update Minicart item quantity */
3405		$(document).on('change', '.woocommerce-mini-cart .qty', function(){
3406			var quantity = parseFloat($(this).val());
3407			var max = parseFloat($(this).attr('max'));
3408			if( max !== 'NaN' && max < quantity ){
3409				quantity = max;
3410				$(this).val( max );
3411			}
3412			
3413			$(this).parents('.woocommerce-mini-cart-item').addClass('loading');
3414			var cart_item_key = $(this).parents('.woocommerce-mini-cart-item').attr('data-cart_item_key');
3415			
3416			var data = {
3417				quantity: quantity,
3418				cart_item_key: cart_item_key,
3419				nonce: themejr_options.nonce,
3420				action: 'themejr_update_cart_widget_quantity',
3421			};
3422			$.ajax({
3423				url: themejr_options.ajax_url,
3424				data: data,
3425				dataType: 'json',
3426				method: 'POST',
3427				success: function (response) {
3428					if( !response ){
3429						return;
3430					}
3431					$( document.body ).trigger( 'added_to_cart', [ response.fragments, response.cart_hash ] );
3432				}				
3433			});
3434		});
3435	};
3436	
3437	themejr.autoCartUpdate = function(){
3438		if( ! themejr_options.cart_auto_update || $('.woocommerce-cart-form').length <= 0){
3439			return;
3440		}
3441		$(document).on('change','.woocommerce-cart-form .product-quantity',function(e) {
3442			$("[name='update_cart']").removeAttr('disabled');
3443			$("[name='update_cart']").trigger("click"); 
3444        });
3445	};
3446	
3447	themejr.checkoutUpdateQuantity = function(){
3448		
3449		/* Update Minicart item quantity */
3450		
3451		if( ! themejr_options.checkout_product_quantity || $('.woocommerce-checkout-review-order-table').length <= 0){
3452			return;
3453		}
3454		
3455		$(document).on('change', '.woocommerce-checkout-review-order-table .qty', function(){
3456			var $form = $( 'form.checkout' );
3457			var form_data =  $( 'form.checkout' ).serialize();
3458			$(".woocommerce-checkout-payment, .woocommerce-checkout-review-order-table").block({
3459                message: null,
3460                overlayCSS: {
3461                    opacity: 0.6
3462                }
3463            })						
3464			var data = {
3465				action 		: 'themejr_update_checkout_quantity',
3466				form_data 	: form_data,
3467				nonce		: themejr_options.nonce,
3468			};
3469			$.ajax({
3470				url: themejr_options.ajax_url,
3471				data: data,
3472				dataType: 'json',
3473				method: 'POST',
3474				success: function (response) {
3475					if( !response ){
3476						location.reload();
3477					}
3478					$.each( response.fragments, function( key, value ) {
3479						$( key ).replaceWith( value );
3480					});			
3481					$( 'body' ).trigger( 'update_checkout' );
3482				},
3483				error: function (jqXHR, exception) {
3484					console.log("Error: Something went wrong.");
3485					$(".woocommerce-checkout-payment, .woocommerce-checkout-review-order-table").unblock();
3486				}
3487			});
3488		});
3489	};
3490	
3491	themejr.getVisitorCount = function(){
3492		
3493		var min,max,delay;
3494		var visitor_elm = $('.themejr-visitor-change');
3495		if(  visitor_elm.length <= 0){
3496			return;
3497		}
3498		min 	= parseInt( visitor_elm.data('min') );
3499		max 	= parseInt( visitor_elm.data('max') );
3500		delay 	= parseInt( visitor_elm.data('delay') );
3501		setInterval(function() {
3502		  var variation = themejrGetRandomInt(min, max );
3503		  visitor_elm.find('.product-visitor-count').html(variation);
3504		}, delay * 1000 );
3505		function themejrGetRandomInt(min, max) {			
3506			let difference = max - min;
3507			let rand = Math.random();
3508			rand = Math.floor( rand * difference);
3509			rand = rand + min;
3510			return rand;
3511		}
3512	}
3513	
3514	themejr.askQuestionsForm = function(){
3515		
3516		var ask_questions_form = $('.themejr-ask-questions-ajax');
3517		if(  ask_questions_form.length <= 0){
3518			return;
3519		}
3520		$('.themejr-ask-questions').magnificPopup({
3521			type: 'inline',
3522			preloader: false,			
3523			removalDelay: 500,
3524			items: {
3525				src: '#themejr-ask-questions-popup' ,					
3526			},
3527			/* mainClass: 'animated bounceIn', */
3528			callbacks: {
3529				open: function() {
3530					var closeSidebar 	= $('.themejr-mask-overaly');
3531					var mobileSidebar = $('.themejr-mobile-menu');
3532					closeSidebar.removeClass('opened');
3533					mobileSidebar.removeClass('opened');
3534					$('.themejr-ask-questions-popup').addClass('animated slideInDown');
3535				},
3536				beforeClose: function() {
3537						var popupWrap = $( '.themejr-ask-questions-popup' );
3538						popupWrap.removeClass('slideInDown').addClass('slideOutUp');
3539					}, 
3540				close: function() {
3541					$('.themejr-ask-questions-popup').removeClass('animated slideOutUp');
3542				}
3543			} 
3544		});
3545		
3546	}
3547	
3548	themejr.themejrEqualTabsHeight = function(){
3549		//*******************************************************************
3550		//* Equal tabs height
3551		//*******************************************************************/
3552		setTimeout(function () {
3553			$('.products-tab-content').each(function () {
3554				var $this = $(this);
3555				if ($this.find('.tab-content').length) {
3556					$this.find('.tab-content').css({
3557						'height': 'auto'
3558					});
3559					var elem_height = 0;
3560					$this.find('.tab-content').each(function () {
3561						var this_elem_h = $(this).height();
3562						if (elem_height < this_elem_h) {
3563							elem_height = this_elem_h;
3564						}
3565					});
3566					$this.find('.tab-content').height(elem_height);
3567				}
3568			});
3569		}, 4000);
3570	};
3571	
3572	themejr.themejrAjaxtab = function() {
3573		/* Ajax tabs */
3574		var category_tab_cache = [];
3575		$(document).on('click', '.products-tabs.enable-ajax .nav-tabs a', function (e) {			
3576			e.preventDefault();			
3577			var $_this 		= $(this),			
3578			data_attr 		= $_this.parent().data(),
3579			atts 			= data_attr.attribute,
3580			data_href 		= $_this.data('href'),
3581			$tab_content 	= $_this.closest('.themejr-element').find('.tab-content'),
3582			$swiper_content 	= $_this.closest('.themejr-element').find('.tab-content .themejr-slider'),
3583			swiper_obj 	= $swiper_content.attr("data-obj_instance"),
3584			element_wrap 	= $_this.closest('.themejr-element').find('.tab-content .products');
3585			
3586			if(category_tab_cache[data_href] != undefined ){
3587				$tab_content.addClass('loading');
3588				var items = category_tab_cache[data_href];
3589				if( swiper_obj !== undefined ){
3590					$tab_content.find('.themejr-slider-navigation').remove();
3591					$tab_content.find('.themejr-slider-pagination').remove();
3592					themejr_sliders[swiper_obj].destroy(true, true);
3593				}				
3594				element_wrap.html(items).fadeIn(600);
3595				$tab_content.removeClass('loading');
3596				themejr.imagelazyload();
3597				themejr.initMagnaficPopup();
3598				themejr.swatchInLoop();
3599				themejr.ProductLoopQuantityField();
3600				themejr.tooltip();
3601				themejr.productQuickView();
3602				themejr.productSaleCountdown();
3603				themejr.themejrElementorSwiperSlider();
3604				return;
3605			}
3606			var data = {
3607					attr: atts,
3608					nonce: themejr_options.nonce,
3609					action: 'themejr_category_tab_product',
3610				};
3611			if($_this.hasClass('process')){ return false;}
3612			$_this.addClass('process');
3613			$tab_content.addClass('loading');
3614			$.ajax({
3615				url: themejr_options.ajax_url,
3616				data: data,
3617				dataType: 'json',
3618				method: 'POST',
3619				success: function(response) {
3620					var items = $('' + response['html'] + '');
3621					category_tab_cache[data_href] = items;
3622					if( swiper_obj !== undefined ){
3623						$tab_content.find('.themejr-slider-navigation').remove();
3624						$tab_content.find('.themejr-slider-pagination').remove();
3625						themejr_sliders[swiper_obj].destroy(true, true);
3626					}
3627					if ($.trim(response['success']) == 'ok') {						
3628						element_wrap.html(items).fadeIn(600);						
3629					} 
3630				},
3631				error: function(data) {
3632					console.log('ajax error');
3633				},
3634				complete: function() {
3635					themejr.isPostLoading = false;
3636					themejr.imagelazyload();
3637					themejr.initMagnaficPopup();
3638					themejr.swatchInLoop();
3639					themejr.ProductLoopQuantityField();
3640					themejr.tooltip();
3641					themejr.productQuickView();
3642					themejr.productSaleCountdown();
3643					themejr.themejrElementorSwiperSlider();
3644					$_this.removeClass('process');
3645					$tab_content.removeClass('loading');
3646				},
3647			});
3648		} );
3649	}
3650	
3651	themejr.themejrResponsiveTab = function() {
3652		/* Responsive tabs */
3653		$(document).on('click', '[data-trigger="tab"]', function (event) {
3654			var href = $( this ).attr( 'href' );
3655			event.preventDefault();
3656			$( '[data-toggle="tab"][href="' + href + '"]' ).trigger( 'click' );
3657		} );
3658
3659	}
3660	
3661	themejr.themejrProgressbar = function() {
3662		/*
3663		* Progress Bar
3664		*/		
3665		$('.progress .progress-bar').each(function(){
3666			if (typeof ($.fn.waypoint) != 'undefined') {
3667				$(this).waypoint(function(){
3668					var width = $(this).attr('data-value');
3669					$(this).animate({
3670							width: width+'%'
3671						},
3672						{
3673							duration: 1000,
3674							easing: 'swing'
3675						}
3676					);
3677				}, { offset: '100%', triggerOnce: true });
3678			}
3679		});	
3680	}
3681	
3682	themejr.themejrCounterUp = function() {
3683		/*
3684		* Counter Up
3685		*/	
3686		if ( ! $.isFunction($.fn.counterUp) ) {
3687			return;
3688		}
3689		jQuery('.counter').counterUp({
3690            delay: 20,
3691            time: 2000
3692        });
3693	}
3694	
3695	themejr.imageGaleryMasonry = function (){
3696		
3697		/*
3698		* Image Gallery Masonry
3699		*/
3700		
3701		if ( ! $('.themejr-image-gallery.image-gallery-masonry-grid').length > 0 ) return;
3702		var $layoutMode='masonry';
3703		
3704		if($( '.themejr-image-gallery.image-gallery-masonry-grid' ).length){
3705			$( '.themejr-image-gallery.image-gallery-masonry-grid' ).each(function(){
3706				
3707				var image_gallery_container = $( this );
3708				/* initialize Masonry after all images have loaded */
3709                image_gallery_container.imagesLoaded(function() {
3710					image_gallery_container.isotope({
3711						itemSelector: '.themejr-gallery',
3712						isOriginLeft: ! $('body').hasClass('rtl'),
3713						layoutMode: $layoutMode
3714					});
3715				 });
3716			});			
3717		}		
3718	};
3719	
3720	/*
3721	 * Document ready
3722	 */ 
3723	$(document).ready(function(){ 
3724		themejr.init();		
3725    });
3726	
3727	$(document).ready(function(){ 
3728		$(window).on('vc_reload', function () {
3729           themejr.init();            
3730        });	
3731    });
3732	
3733	$( window ).on('load', function () {
3734		var themejr_pre_loader = $( '.themejr-site-preloader' );
3735		if ( themejr_pre_loader.length ) {
3736            themejr_pre_loader.fadeOut( 800 );
3737		}
3738	});
3739	
3740	var ElementorCounterUp = function($scope, $) {
3741		var $this = $scope.find('.counter');
3742		$this.counterUp({
3743            delay: 20,
3744            time: 2000
3745        });
3746	};
3747	
3748	var ElementorImaeGalleryMasonary = function($scope, $) {	
3749		var $layoutMode = 'masonry';
3750		var image_gallery_container = $scope.find('.image-gallery-masonry-grid');
3751		
3752		if(image_gallery_container.length){
3753			/* initialize Masonry after all images have loaded */
3754			image_gallery_container.imagesLoaded(function() {
3755				image_gallery_container.isotope({
3756					itemSelector: '.themejr-gallery',
3757					isOriginLeft: ! $('body').hasClass('rtl'),
3758					layoutMode: $layoutMode
3759				});
3760			});	
3761		}		
3762	};
3763	
3764	var Elementorcountdown = function($scope, $) {
3765		var $this = $scope.find('.themejr-countdown-timer'),
3766			template 	= '',
3767			end_date = $this.data('end-date');
3768			
3769		if( $this.data('countdown-style') == 'countdown-box' ) {
3770			template = '<span class="days">%-D<span>'+themejr_options.js_translate_text.days_text+'</span></span><span class="hour">%H<span>'+themejr_options.js_translate_text.hours_text+'</span></span><span class="minute">%M<span>'+themejr_options.js_translate_text.mins_text+'</span></span><span class="second">%S<span>'+themejr_options.js_translate_text.secs_text+'</span></span>';
3771		}else{
3772			template = '%-D'+themejr_options.js_translate_text.sdays_text+':%H'+themejr_options.js_translate_text.shours_text+':%M'+themejr_options.js_translate_text.smins_text+':%S'+themejr_options.js_translate_text.ssecs_text;
3773		}
3774		
3775		/* initialize  */
3776		$this.countdown( end_date, function(event) {
3777			 $(this).html(event.strftime(template));
3778		});
3779	};
3780	
3781	themejr.themejrElementorSwiperSlider = function() {
3782		/*
3783		* Swiper Slider
3784		*/
3785		setTimeout( function(){
3786			$( '.themejr-slider' ).each( function ( index, element ) {
3787				
3788				var $selector 	= $(this),
3789				slider_index 	= 'swiper-'+index,
3790				$sliderWrapper 	= $selector.find( '.swiper-wrapper' ),
3791				numItems 		= $sliderWrapper.children().length,				
3792				$obj_instance 	= $selector.attr( "data-obj_instance", slider_index ),
3793				sliderArg 		= ( $sliderWrapper.attr('data-slider_options') ) ? $sliderWrapper.data('slider_options') : {},
3794				touchMove = ( sliderArg.slider_touchDrag ) ? true : false,
3795				touchMove_mobile = ( sliderArg.slider_touchDrag_mobile ) ? true : false,
3796				options = {
3797					loop: false,
3798					//cssMode: true,
3799					allowTouchMove:touchMove,
3800					autoHeight:( sliderArg.slider_autoHeigh ) ? true : false,
3801					rewind:( sliderArg.slider_rewind ) ? true : false,
3802					slidesPerView: parseInt(sliderArg.slides_to_show),
3803					slidesPerGroup: parseInt(sliderArg.slides_to_scroll),
3804					spaceBetween: parseInt(sliderArg.slider_spaceBetween),
3805					breakpoints: {
3806						0: {
3807							slidesPerView: parseInt( sliderArg.slides_to_show_mobile ),
3808							allowTouchMove: touchMove_mobile,
3809						},
3810						768: {
3811							slidesPerView: parseInt( sliderArg.slides_to_show_tablet ),
3812							allowTouchMove: touchMove_mobile,
3813						},
3814						1025: {
3815							slidesPerView: parseInt( sliderArg.slides_to_show ),
3816						},
3817					}
3818				};
3819				
3820				if( sliderArg.slider_loop === true ){
3821					options.loop = ( numItems > parseInt(sliderArg.slides_to_show)) ? sliderArg.slider_loop : false;
3822				}					
3823				if( sliderArg.slider_autoplay === true ){
3824					options.autoplay = {
3825						delay: parseInt( sliderArg.slider_autoplay_speed ),
3826						disableOnInteraction: false,
3827						pauseOnMouseEnter: sliderArg.slider_pause_on_hover
3828					}
3829				} 
3830				options.speed = parseInt( sliderArg.slider_autoplay_speed );
3831				
3832				if( !$selector.parent().hasClass('themejr-slider-wrapper') ) {
3833					$selector.wrap('<div class="themejr-slider-wrapper"/>');
3834				}				
3835				if($sliderWrapper.hasClass('product-style-3')){
3836					$sliderWrapper.closest('.themejr-slider-wrapper').addClass('product-layout-3');
3837				}
3838				var $selectorWrap = $selector.closest('.themejr-slider-wrapper');
3839				
3840				/* Add Pagination */
3841				if ( sliderArg.slider_pagination === true && 0 === $selectorWrap.find('> .themejr-slider-pagination').length) {
3842					$selector.addClass('swiper-paginataion');
3843					$selector.after('<div class="themejr-slider-pagination"></div>');
3844					options.pagination = {
3845						el: $selectorWrap.find('.themejr-slider-pagination')[0],
3846						clickable: true
3847					}
3848				}
3849
3850				/* Add Navigation */
3851				if (sliderArg.slider_navigation === true && 0 === $selectorWrap.find('> .themejr-slider-navigation').length) {
3852					$selector.after('<div class="themejr-slider-navigation"><div class="themejr-slider-prev"></div><div class="themejr-slider-next"></div></div>');
3853					options.navigation = {
3854						prevEl: $selectorWrap.find('.themejr-slider-prev')[0],
3855						nextEl: $selectorWrap.find('.themejr-slider-next')[0],
3856					}
3857				}
3858				
3859				$selector.addClass(slider_index);
3860				var $swiperObj = new Swiper( '.'+slider_index, options );
3861				if( themejr.isCheckRTL() ){
3862					$swiperObj.changeLanguageDirection('rtl');
3863				}
3864				themejr_sliders[slider_index] = $swiperObj;
3865			});
3866		}, 300 );
3867		
3868		/* function add_slider_overlayclass(){
3869			$('.themejr-slider-wrapper').mouseenter(function(){
3870				var slider_elemnt = $(this).find('.swiper-wrapper');
3871				if( slider_elemnt.hasClass('product-style-3') ){
3872					var slider_elemnt2 = $(this).closest('.themejr-slider-wrapper');
3873					slider_elemnt2.addClass('overlay');
3874				}
3875			}).mouseleave(function(){
3876				//var slider_elemnt = $(this).find('.themejr-slider-wrapper');
3877				if( $(this).hasClass('overlay') ){
3878					$(this).removeClass('overlay');
3879				}
3880				
3881			});
3882		}
3883		setTimeout(function() { add_slider_overlayclass() }, 1000 );
3884		 */
3885		/* function add_slider_overlayclass(){
3886			$('.swiper .themejr-product-inner').mouseenter(function(){
3887				var slider_elemnt = $(this).closest('.themejr-slider-wrapper');
3888				slider_elemnt.addClass('overlay');
3889			}).mouseleave(function(){
3890				var slider_elemnt = $(this).closest('.themejr-slider-wrapper');
3891				slider_elemnt.removeClass('overlay');
3892			});
3893		}
3894		setTimeout(function() { add_slider_overlayclass() }, 1000 ); */
3895		
3896	}
3897	
3898	themejr.BackgroundParallax = function(){
3899		/*
3900		* Parallax Background
3901		*/		
3902		if ($(window).width() <= 1024) {
3903			return;
3904		}
3905		$('.themejr-parallax-background').each(function() {			
3906			$(this).parallax("50%", 0.3);
3907		});
3908	};
3909	
3910	themejr.accordion = function(){
3911		if($('.themejr-accordion').length > 0 ){
3912			var $accordion = $('.themejr-accordion');			
3913			$('.themejr-accordion').each(function () {
3914				var $element = $(this).find('.themejr-accordion-item > .card-header .card-link');
3915				$element.off('click').on('click', function(e) {
3916					console.log('click');
3917					e.preventDefault();
3918					var style = $(this).attr('data-style');
3919					if( $(this).hasClass("open") ) {
3920						$(this).removeClass("open");
3921						$(this).closest('.card ').find('.collapse').slideUp(300);
3922					}else{						
3923						if( style != 'toggle'){
3924							$(this).closest('.card ').siblings().find('.card-link').removeClass("open");
3925							$(this).closest('.card ').siblings().find('.collapse').slideUp(300);
3926						}
3927						$(this).addClass("open");
3928						$(this).closest('.card ').find('.collapse').slideDown(300);
3929					}
3930				});
3931			});
3932		} 
3933	}
3934	/* Elementor Elements*/
3935	$( window ).on( 'elementor/frontend/init', function () {
3936		if (!elementorFrontend.isEditMode()) {
3937			return;
3938		}
3939		
3940		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-accordion.default', themejr.accordion)
3941		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-counter.default', ElementorCounterUp)
3942		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-countdown.default', Elementorcountdown);
3943		
3944		
3945		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-image-gallery.default', function($wrapper, $) {
3946			themejr.themejrElementorSwiperSlider($wrapper, $);
3947			ElementorImaeGalleryMasonary($wrapper, $);
3948		});
3949		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-progress-bar.default', function($wrapper, $) {
3950			themejr.themejrProgressbar();
3951		});
3952		
3953		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-testimonials.default', function($wrapper, $) {
3954			themejr.themejrElementorSwiperSlider($wrapper, $);
3955		});
3956		
3957		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-team.default', function($wrapper, $) {
3958			themejr.themejrElementorSwiperSlider($wrapper, $);
3959		});
3960		
3961		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-banner-slider.default', function($wrapper, $) {
3962			themejr.themejrElementorSwiperSlider($wrapper, $);
3963		});
3964		
3965		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-product-categories-thumbnail.default', function($wrapper, $) {
3966			themejr.themejrElementorSwiperSlider($wrapper, $);
3967		});
3968		
3969		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-product-categories.default', function($wrapper, $) {
3970			themejr.themejrElementorSwiperSlider($wrapper, $);
3971		});
3972		
3973		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-custom-categories.default', function($wrapper, $) {
3974			themejr.themejrElementorSwiperSlider($wrapper, $);
3975		});
3976		
3977		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-products-widget.default', function($wrapper, $) {
3978			themejr.themejrElementorSwiperSlider($wrapper, $);
3979		});
3980		
3981		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-product-brands.default', function($wrapper, $) {
3982			themejr.themejrElementorSwiperSlider($wrapper, $);
3983		});		
3984		
3985		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-products-grid-slider.default', function($wrapper, $) {
3986			themejr.themejrElementorSwiperSlider($wrapper, $);
3987			themejr.productSaleCountdown();
3988			themejr.tooltip();
3989			themejr.imagelazyload();
3990			themejr.productSwatch();
3991			themejr.productQuickView();
3992			themejr.addToCompare();
3993		});
3994		
3995		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-hot-deal-products.default', function($wrapper, $) {
3996			themejr.themejrElementorSwiperSlider($wrapper, $);
3997			Elementorcountdown($wrapper, $);
3998			themejr.productSaleCountdown();
3999		});
4000		
4001		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-products-and-categories_box.default', function($wrapper, $) {
4002			themejr.themejrElementorSwiperSlider($wrapper, $);
4003		});
4004		
4005		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-products-recently-viewed.default', function($wrapper, $) {
4006			themejr.themejrElementorSwiperSlider($wrapper, $);
4007		});
4008		
4009		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-products-with-banner.default', function($wrapper, $) {
4010			themejr.themejrElementorSwiperSlider($wrapper, $);
4011		});
4012		
4013		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-products-tabs.default', function($wrapper, $) {
4014			themejr.themejrElementorSwiperSlider($wrapper, $);
4015		});
4016		
4017		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-blog.default', function($wrapper, $) {
4018			themejr.MasonryGrid();
4019		});		
4020		
4021		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-blog-slider.default', function($wrapper, $) {
4022			themejr.themejrElementorSwiperSlider($wrapper, $);
4023		});
4024		
4025		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-wcfm-vendors.default', function($wrapper, $) {
4026			themejr.themejrElementorSwiperSlider($wrapper, $);
4027		});
4028		
4029		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-dokan-vendors.default', function($wrapper, $) {
4030			themejr.themejrElementorSwiperSlider($wrapper, $);
4031		});
4032		
4033		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-wcmp-vendors.default', function($wrapper, $) {
4034			themejr.themejrElementorSwiperSlider($wrapper, $);
4035		});
4036		
4037		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-wc-vendors.default', function($wrapper, $) {
4038			themejr.themejrElementorSwiperSlider($wrapper, $);
4039		});
4040		
4041		elementorFrontend.hooks.addAction('frontend/element_ready/themejr-instagram.default', function($wrapper, $) {
4042			themejr.themejrElementorSwiperSlider($wrapper, $);
4043		});
4044		
4045	});
4046})(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.