PageSourceSearch

https://tradzhub.in/template/front/js/theme.js

js tradzhub.in collected 2026-10-02 01:02:56 UTC 16,375 bytes, 507 lines download raw bytes

1'use strict';
2
3// Cache
4var body = $('body');
5var mainSlider = $('#main-slider');
6var mainSliderSize = $('#main-slider').find('.item').size();
7
8var imageCarousel = $('.img-carousel');
9var imageCarouselSize = $('.img-carousel').find('.item').size();
10
11var testimonialsCarousel = $('#testimonials');
12var testimonialsCarouselSize = $('#testimonials').find('.testimonial').size();
13
14var partnersCarousel = $('.partners');
15var partnersCarousel2 = $('.partners2');
16var topProductsCarousel = $('#top-products-carousel');
17var featuredProductsCarousel = $('#featured-products-carousel');
18var sidebarProductsCarousel = $('#sidebar-products-carousel');
19var hotDealsCarousel = $('#hot-deals-carousel');
20var owlCarouselSelector = $('.owl-carousel');
21var isotopeContainer = $('.isotope');
22var isotopeFiltrable = $('#filtrable a');
23var toTop = $('#to-top');
24var hover = $('.thumbnail');
25var navigation = $('.navigation');
26var superfishMenu = $('ul.sf-menu');
27var priceSliderRange = $('#slider-range');
28
29// Slide in/out with fade animation function
30jQuery.fn.slideFadeToggle  = function(speed, easing, callback) {
31    return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);
32};
33//
34jQuery.fn.slideFadeIn  = function(speed, easing, callback) {
35    return this.animate({opacity: 'show', height: 'show'}, speed, easing, callback);
36};
37jQuery.fn.slideFadeOut  = function(speed, easing, callback) {
38    return this.animate({opacity: 'hide', height: 'hide'}, speed, easing, callback);
39};
40
41jQuery(document).ready(function () {
42    // Prevent empty links
43    // ---------------------------------------------------------------------------------------
44    $('a[href=#]').click(function (event) {
45        event.preventDefault();
46    });
47    // Sticky header/menu
48    // ---------------------------------------------------------------------------------------
49    if ($().sticky) {
50        $('.header.fixed').sticky({topSpacing:0});
51        //$('.header.fixed').on('sticky-start', function() { console.log("Started"); });
52        //$('.header.fixed').on('sticky-end', function() { console.log("Ended"); });
53    }
54    // SuperFish menu
55    // ---------------------------------------------------------------------------------------
56    if ($().superfish) {
57        superfishMenu.superfish();
58    }
59    $('ul.sf-menu a').click(function () {
60        body.scrollspy('refresh');
61    });
62    // Fixed menu toggle
63    $('.menu-toggle').on('click', function () {
64        if (navigation.hasClass('opened')) {
65            navigation.removeClass('opened').addClass('closed');
66        } else {
67            navigation.removeClass('closed').addClass('opened');
68        }
69    });
70    $('.menu-toggle-close').on('click', function () {
71        if (navigation.hasClass('opened')) {
72            navigation.removeClass('opened').addClass('closed');
73        } else {
74            navigation.removeClass('closed').addClass('opened');
75        }
76    });
77    // Smooth scrolling
78    // ----------------------------------------------------------------------------------------
79    $('.sf-menu a, .scroll-to').click(function () {
80
81        $('.sf-menu a').removeClass('active');
82        $(this).addClass('active');
83        $('html, body').animate({
84            scrollTop: $($(this).attr('href')).offset().top
85        }, {
86            duration: 1200,
87            easing: 'easeInOutExpo'
88        });
89        return false;
90    });
91    // BootstrapSelect
92    // ---------------------------------------------------------------------------------------
93    if ($().selectpicker) {
94        $('.selectpicker').selectpicker();
95    }
96    // prettyPhoto
97    // ---------------------------------------------------------------------------------------
98    if ($().prettyPhoto) {
99        $("a[data-gal^='prettyPhoto']").prettyPhoto({
100            theme: 'dark_square'
101        });
102    }
103    // Scroll totop button
104    // ---------------------------------------------------------------------------------------
105    $(window).scroll(function () {
106        if ($(this).scrollTop() > 1) {
107            toTop.css({bottom: '15px'});
108        } else {
109            toTop.css({bottom: '-100px'});
110        }
111    });
112    toTop.click(function () {
113        $('html, body').animate({scrollTop: '0px'}, 800);
114        return false;
115    });
116    // Add hover class for correct view on mobile devices
117    // ---------------------------------------------------------------------------------------
118    hover.hover(
119        function () {
120            $(this).addClass('hover');
121        },
122        function () {
123            $(this).removeClass('hover');
124        }
125    );
126    // Sliders
127    // ---------------------------------------------------------------------------------------
128    if ($().owlCarousel) {
129        var owl = $('.owl-carousel');
130        owl.on('changed.owl.carousel', function(e) {
131            // update prettyPhoto
132            if ($().prettyPhoto) {
133                $("a[data-gal^='prettyPhoto']").prettyPhoto({
134                    theme: 'dark_square'
135                });
136            }
137        });
138        // Main slider
139        if (mainSlider.length) {
140			mainSlider.each(function(){
141				var mainSliderSizeNew = $(this).find('.item').size();
142				$(this).owlCarousel({
143					//items: 1,
144					autoplay: true,
145					autoplayHoverPause: false,
146					loop: mainSliderSizeNew > 1 ? true : false,
147					margin: 0,
148					dots: true,
149					nav: true,
150					navText: [
151						"<i class='fa fa-angle-left'></i>",
152						"<i class='fa fa-angle-right'></i>"
153					],
154					responsiveRefreshRate: 100,
155					responsive: {
156						0: {items: 1},
157						479: {items: 1},
158						768: {items: 1},
159						991: {items: 1},
160						1024: {items: 1}
161					}
162				});
163			});
164        }
165        // Top products carousel
166        if (topProductsCarousel.length) {
167			topProductsCarousel.owlCarousel({
168				autoplay: true,
169				loop: true,
170				autoplayHoverPause: true,
171				margin: 30,
172				dots: false,
173				nav: true,
174				navText: [
175					"<i class='fa fa-angle-left'></i>",
176					"<i class='fa fa-angle-right'></i>"
177				],
178				responsive: {
179					0: {items: 1},
180					479: {items: 2},
181					768: {items: 3},
182					991: {items: 4},
183					1024: {items: 5},
184					1280: {items: 6}
185				}
186			});
187        }
188        // Featured products carousel
189        if (featuredProductsCarousel.length) {
190			featuredProductsCarousel.owlCarousel({
191				autoplay: true,
192				autoplayHoverPause: true,
193				loop:true,
194				margin: 30,
195				dots: false,
196				nav: true,
197				navText: [
198					"<i class='fa fa-angle-left'></i>",
199					"<i class='fa fa-angle-right'></i>"
200				],
201				responsive: {
202					0: {items: 2},
203					479: {items: 2},
204					768: {items: 2},
205					991: {items: 5},
206					1024: {items: 5}
207				}
208			});
209        }
210        // Sidebar products carousel
211        if (sidebarProductsCarousel.length) {
212			sidebarProductsCarousel.each(function(){
213				var sidebarProductsCarouselSizeNew = $(this).find('.item').size();
214				$(this).owlCarousel({
215					autoplay: true,
216					autoplayHoverPause: true,
217					loop: sidebarProductsCarouselSizeNew > 1 ? true : false,
218					margin: 30,
219					dots: true,
220					nav: false,
221					navText: [
222						"<i class='fa fa-angle-left'></i>",
223						"<i class='fa fa-angle-right'></i>"
224					],
225					responsive: {
226						0: {items: 1},
227						479: {items: 1},
228						768: {items: 1},
229						991: {items: 1},
230						1024: {items: 1}
231					}
232				});
233			});
234        }
235        // Partners carousel
236        if (partnersCarousel.length) {
237			partnersCarousel.owlCarousel({
238				autoplay: false,
239				autoplayHoverPause: true,
240				loop: true,
241				margin: 30,
242				dots: false,
243				nav: true,
244				navText: [
245					"<i class='fa fa-angle-left'></i>",
246					"<i class='fa fa-angle-right'></i>"
247				],
248				responsiveClass:true,
249				responsive: {
250					0: {items: 2},
251					479: {items: 2},
252					768: {items: 4},
253					991: {items: 4},
254					1024: {items: 6},
255					1280: {items: 6}
256				}
257			});
258        }
259		// Partners carousel2
260        if (partnersCarousel2.length) {
261			partnersCarousel2.owlCarousel({
262				autoplay: true,
263				autoplayHoverPause: true,
264				loop: true,
265				margin: 30,
266				dots: false,
267				nav: true,
268				navText: [
269					"<i class='fa fa-angle-left'></i>",
270					"<i class='fa fa-angle-right'></i>"
271				],
272				responsive: {
273					0: {items: 3},
274					479: {items: 3},
275					768: {items: 6},
276					991: {items: 8},
277					1024: {items: 8},
278					1280: {items: 10}
279				}
280			});
281        }
282        // Testimonials carousel
283        if (testimonialsCarousel.length) {
284			testimonialsCarousel.each(function(){
285				var testimonialsCarouselSizeNew = $(this).find('.testimonial').size();
286				$(this).owlCarousel({
287					autoplay: true,
288					autoplayHoverPause: true,
289					loop: testimonialsCarouselSizeNew > 1 ? true : false,
290					margin: 0,
291					dots: true,
292					nav: false,
293					navText: [
294						"<i class='fa fa-angle-left'></i>",
295						"<i class='fa fa-angle-right'></i>"
296					],
297					responsive: {
298						0: {items: 1},
299						479: {items: 1},
300						768: {items: 1},
301						991: {items: 1},
302						1024: {items: 1},
303						1280: {items: 1}
304					}
305				});
306			});
307        }
308        // Images carousel
309        if (imageCarousel.length) {
310			imageCarousel.each(function(){
311				var imageCarouselSizeNew = $(this).find('.item').size();
312				$(this).owlCarousel({
313					autoplay: true,
314                	autoplayHoverPause: true,
315					loop: imageCarouselSizeNew > 1 ? true : false,
316					margin: 0,
317					dots: true,
318					nav: true,
319					navText: [
320						"<i class='fa fa-angle-left'></i>",
321						"<i class='fa fa-angle-right'></i>"
322					],
323					responsiveRefreshRate: 100,
324					responsive: {
325						0: {items: 1},
326						479: {items: 1},
327						768: {items: 1},
328						991: {items: 1},
329						1024: {items: 1}
330					}
331				});
332			});
333        }
334    }
335    // countdown
336    // ---------------------------------------------------------------------------------------
337    if ($().countdown) {
338        var austDay = new Date();
339        austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);
340        $('#dealCountdown1').countdown({until: austDay});
341        $('#dealCountdown2').countdown({until: austDay});
342        $('#dealCountdown3').countdown({until: austDay});
343    }
344    // Google map
345    // ---------------------------------------------------------------------------------------
346    if (typeof google === 'object' && typeof google.maps === 'object') {
347        if ($('#map-canvas').length) {
348            var map;
349            var marker;
350            var image = 'assets/img/icon-google-map.png'; // marker icon
351            google.maps.event.addDomListener(window, 'load', function () {
352                var mapOptions = {
353                    scrollwheel: false,
354                    zoom: 12,
355                    center: new google.maps.LatLng(40.9807648, 28.9866516) // map coordinates
356                };
357
358                map = new google.maps.Map(document.getElementById('map-canvas'),
359                    mapOptions);
360                marker = new google.maps.Marker({
361                    position: new google.maps.LatLng(41.0096559,28.9755535), // marker coordinates
362                    map: map,
363                    icon: image,
364                    title: 'Hello World!'
365                });
366            });
367        }
368    }
369    // Price range / need jquery ui
370    // ---------------------------------------------------------------------------------------
371    if ($.ui) {
372        /*
373        if ($(priceSliderRange).length) {
374            $(priceSliderRange).slider({
375                range: true,
376                min: 0,
377                max: 500,
378                values: [75, 300],
379                slide: function (event, ui) {
380                    $("#amount").val("$" + ui.values[0] + " - $" + ui.values[1]);
381                }
382            });
383            $("#amount").val(
384                "$" + $("#slider-range").slider("values", 0) +
385                " - $" + $("#slider-range").slider("values", 1)
386            );
387        }
388        */
389
390    }
391
392
393            
394    // Shop categories widget slide in/out
395    // ---------------------------------------------------------------------------------------
396    $('.shop-categories .arrow').click(
397        function () {
398
399            $(this).parent().parent().find('ul.children').removeClass('active');
400            $(this).parent().parent().find('.fa-angle-up').addClass('fa-angle-down').removeClass('fa-angle-up');
401            if ($(this).parent().find('ul.children').is(":visible")) {
402                //$(this).find('.fa-angle-up').addClass('fa-angle-down').removeClass('fa-angle-up');
403                //$(this).parent().find('ul.children').removeClass('active');
404            }
405            else {
406                $(this).find('.fa-angle-down').addClass('fa-angle-up').removeClass('fa-angle-down');
407                $(this).parent().find('ul.children').addClass('active');
408            }
409            $(this).parent().parent().find('ul.children').each(function () {
410                if (!$(this).hasClass('active')) {
411                    $(this).slideFadeOut();
412                }
413                else {
414                    $(this).slideFadeIn();
415                }
416            });
417        }
418    );
419    $('.shop-categories ul.children').each(function () {
420        if (!$(this).hasClass('active')) {
421            $(this).hide();
422        }
423    });
424});
425
426jQuery(window).load(function () {
427    // Preloader
428    $('#status').fadeOut();
429    $('#preloader').delay(200).fadeOut(200);
430    // Isotope
431    if ($().isotope) {
432        isotopeContainer.isotope({ // initialize isotope
433            itemSelector: '.isotope-item' // options...
434            //,transitionDuration: 0 // disable transition
435        });
436        isotopeFiltrable.click(function () { // filter items when filter link is clicked
437            var selector = $(this).attr('data-filter');
438            isotopeFiltrable.parent().removeClass('current');
439            $(this).parent().addClass('current');
440            isotopeContainer.isotope({filter: selector});
441            return false;
442        });
443        isotopeContainer.isotope('reLayout'); // layout/reLayout
444    }
445    // Scroll to hash
446    if (location.hash != '') {
447        var hash = '#' + window.location.hash.substr(1);
448        if (hash.length) {
449            body.delay(0).animate({
450                scrollTop: jQuery(hash).offset().top
451            }, {
452                duration: 1200,
453                easing: "easeInOutExpo"
454            });
455        }
456    }
457    // OwlSliders
458    if ($().owlCarousel) {
459        // Hot deal carousel
460        // must initialized after counters
461        if (hotDealsCarousel.length) {
462            hotDealsCarousel.owlCarousel({
463                autoplay: true,
464                loop: true,
465                margin: 30,
466                dots: true,
467                nav: false,
468                navText: [
469                    "<i class='fa fa-angle-left'></i>",
470                    "<i class='fa fa-angle-right'></i>"
471                ],
472                responsive: {
473                    0: {items: 1},
474                    479: {items: 1},
475                    768: {items: 1},
476                    991: {items: 1},
477                    1024: {items: 1}
478                }
479            });
480        }
481    }
482    // Refresh owl carousels/sliders
483    owlCarouselSelector.trigger('refresh');
484    owlCarouselSelector.trigger('refresh.owl.carousel');
485});
486
487jQuery(window).resize(function () {
488    // Refresh owl carousels/sliders
489    owlCarouselSelector.trigger('refresh');
490    owlCarouselSelector.trigger('refresh.owl.carousel');
491    // Refresh isotope
492    if ($().isotope) {
493        isotopeContainer.isotope('reLayout'); // layout/relayout on window resize
494    }
495    if ($().sticky) {
496        $('.header.fixed').sticky('update');
497    }
498});
499
500jQuery(window).scroll(function () {
501    // Refresh owl carousels/sliders
502    owlCarouselSelector.trigger('refresh');
503    owlCarouselSelector.trigger('refresh.owl.carousel');
504    if ($().sticky) {
505        $('.header.fixed').sticky('update');
506    }
507});

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.