PageSourceSearch

https://spotopenblog.uk/static/blogapp/assets/js/script.js

js spotopenblog.uk collected 2026-10-07 03:03:48 UTC 23,243 bytes, 804 lines download raw bytes

1(function ($) {
2
3    "use strict";
4
5
6    /*------------------------------------------
7        = ALL ESSENTIAL FUNCTIONS
8    -------------------------------------------*/
9    // Toggle mobile navigation
10    function toggleMobileNavigation() {
11        var navbar = $(".navigation-holder");
12        var openBtn = $(".mobail-menu .open-btn");
13        var xbutton = $(".mobail-menu .navbar-toggler");
14
15        openBtn.on("click", function (e) {
16            e.stopImmediatePropagation();
17            navbar.toggleClass("slideInn");
18            xbutton.toggleClass("x-close");
19            return false;
20        })
21    }
22
23    toggleMobileNavigation();
24
25
26    // Function for toggle class for small menu
27    function toggleClassForSmallNav() {
28        var windowWidth = window.innerWidth;
29        var mainNav = $("#navbar > ul");
30
31        if (windowWidth <= 991) {
32            mainNav.addClass("small-nav");
33        } else {
34            mainNav.removeClass("small-nav");
35        }
36    }
37
38    toggleClassForSmallNav();
39
40
41    // Function for small menu
42    function smallNavFunctionality() {
43        var windowWidth = window.innerWidth;
44        var mainNav = $(".navigation-holder");
45        var smallNav = $(".navigation-holder > .small-nav");
46        var subMenu = smallNav.find(".sub-menu");
47        var megamenu = smallNav.find(".mega-menu");
48        var menuItemWidthSubMenu = smallNav.find(".menu-item-has-children > a");
49
50        if (windowWidth <= 991) {
51            subMenu.hide();
52            megamenu.hide();
53            menuItemWidthSubMenu.on("click", function (e) {
54                var $this = $(this);
55                $this.siblings().slideToggle();
56                e.preventDefault();
57                e.stopImmediatePropagation();
58                $this.toggleClass("rotate");
59            })
60        } else if (windowWidth > 991) {
61            mainNav.find(".sub-menu").show();
62            mainNav.find(".mega-menu").show();
63        }
64    }
65
66    smallNavFunctionality();
67
68    $("body").on("click", function () {
69        $('.navigation-holder').removeClass('slideInn');
70    });
71    $(".menu-close").on("click", function () {
72        $('.navigation-holder').removeClass('slideInn');
73    });
74    $(".menu-close").on("click", function () {
75        $('.open-btn').removeClass('x-close');
76    });
77
78    // toggle1
79    $('#toggle1').on("click", function () {
80        $('.create-account').slideToggle();
81        $('.caupon-wrap.s1').toggleClass('active-border')
82    })
83
84    // toggle2
85    $('#toggle2').on("click", function () {
86        $('#open2').slideToggle();
87        $('.caupon-wrap.s2').toggleClass('coupon-2')
88    })
89
90    // toggle3
91    $('#toggle3').on("click", function () {
92        $('#open3').slideToggle();
93        $('.caupon-wrap.s2').toggleClass('coupon-2')
94    })
95    // toggle4
96    $('#toggle4').on("click", function () {
97        $('#open4').slideToggle();
98        $('.caupon-wrap.s3').toggleClass('coupon-2')
99    })
100
101    $('.payment-select .addToggle').on('click', function () {
102        $('.payment-name').addClass('active')
103        $('.payment-option').removeClass('active')
104    })
105
106
107    $('.payment-select .removeToggle').on('click', function () {
108        $('.payment-option').addClass('active')
109        $('.payment-name').removeClass('active')
110    });
111
112
113    // tooltips
114
115    var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
116    var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
117        return new bootstrap.Tooltip(tooltipTriggerEl)
118    })
119
120    // Parallax background
121    function bgParallax() {
122        if ($(".parallax").length) {
123            $(".parallax").each(function () {
124                var height = $(this).position().top;
125                var resize = height - $(window).scrollTop();
126                var doParallax = -(resize / 5);
127                var positionValue = doParallax + "px";
128                var img = $(this).data("bg-image");
129
130                $(this).css({
131                    backgroundImage: "url(" + img + ")",
132                    backgroundPosition: "50%" + positionValue,
133                    backgroundSize: "cover"
134                });
135            });
136        }
137    }
138
139    // HERO SLIDER
140    var menu = [];
141    jQuery('.swiper-slide').each(function (index) {
142        menu.push(jQuery(this).find('.slide-inner').attr("data-text"));
143    });
144    var interleaveOffset = 0.5;
145    var swiperOptions = {
146        loop: true,
147        speed: 1000,
148        parallax: true,
149        autoplay: {
150            delay: 6500,
151            disableOnInteraction: false,
152        },
153        watchSlidesProgress: true,
154        pagination: {
155            el: '.swiper-pagination',
156            clickable: true,
157        },
158
159        navigation: {
160            nextEl: '.swiper-button-next',
161            prevEl: '.swiper-button-prev',
162        },
163
164        on: {
165            progress: function () {
166                var swiper = this;
167                for (var i = 0; i < swiper.slides.length; i++) {
168                    var slideProgress = swiper.slides[i].progress;
169                    var innerOffset = swiper.width * interleaveOffset;
170                    var innerTranslate = slideProgress * innerOffset;
171                    swiper.slides[i].querySelector(".slide-inner").style.transform =
172                        "translate3d(" + innerTranslate + "px, 0, 0)";
173                }
174            },
175
176            touchStart: function () {
177                var swiper = this;
178                for (var i = 0; i < swiper.slides.length; i++) {
179                    swiper.slides[i].style.transition = "";
180                }
181            },
182
183            setTransition: function (speed) {
184                var swiper = this;
185                for (var i = 0; i < swiper.slides.length; i++) {
186                    swiper.slides[i].style.transition = speed + "ms";
187                    swiper.slides[i].querySelector(".slide-inner").style.transition =
188                        speed + "ms";
189                }
190            }
191        }
192    };
193
194    var swiper = new Swiper(".swiper-container", swiperOptions);
195
196    // DATA BACKGROUND IMAGE
197    var sliderBgSetting = $(".slide-bg-image");
198    sliderBgSetting.each(function (indx) {
199        if ($(this).attr("data-background")) {
200            $(this).css("background-image", "url(" + $(this).data("background") + ")");
201        }
202    });
203
204
205
206
207
208    /*------------------------------------------
209        = HIDE PRELOADER
210    -------------------------------------------*/
211    function preloader() {
212        if ($('.preloader').length) {
213            $('.preloader').delay(100).fadeOut(500, function () {
214
215                //active wow
216                wow.init();
217
218
219
220            });
221        }
222    }
223
224
225    /*------------------------------------------
226        = WOW ANIMATION SETTING
227    -------------------------------------------*/
228    var wow = new WOW({
229        boxClass: 'wow',      // default
230        animateClass: 'animated', // default
231        offset: 0,          // default
232        mobile: true,       // default
233        live: true        // default
234    });
235
236
237    /*------------------------------------------
238         = ACTIVE POPUP IMAGE
239     -------------------------------------------*/
240    if ($(".fancybox").length) {
241        $(".fancybox").fancybox({
242            openEffect: "elastic",
243            closeEffect: "elastic",
244            wrapCSS: "project-fancybox-title-style"
245        });
246    }
247
248
249    /*------------------------------------------
250        = POPUP YOUTUBE, VIMEO, GMAPS
251    -------------------------------------------*/
252    $('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
253        type: 'iframe',
254        mainClass: 'mfp-fade',
255        removalDelay: 160,
256        preloader: false,
257        fixedContentPos: false
258    });
259
260
261
262    /*------------------------------------------
263        = POPUP VIDEO
264    -------------------------------------------*/
265    if ($(".video-btn").length) {
266        $(".video-btn").on("click", function () {
267            $.fancybox({
268                href: this.href,
269                type: $(this).data("type"),
270                'title': this.title,
271                helpers: {
272                    title: { type: 'inside' },
273                    media: {}
274                },
275
276                beforeShow: function () {
277                    $(".fancybox-wrap").addClass("gallery-fancybox");
278                }
279            });
280            return false
281        });
282    }
283
284
285    /*------------------------------------------
286        = ACTIVE GALLERY POPUP IMAGE
287    -------------------------------------------*/
288    if ($(".popup-gallery").length) {
289        $('.popup-gallery').magnificPopup({
290            delegate: 'a',
291            type: 'image',
292
293            gallery: {
294                enabled: true
295            },
296
297            zoom: {
298                enabled: true,
299
300                duration: 300,
301                easing: 'ease-in-out',
302                opener: function (openerElement) {
303                    return openerElement.is('img') ? openerElement : openerElement.find('img');
304                }
305            }
306        });
307    }
308
309
310    /*------------------------------------------
311        = FUNCTION FORM SORTING GALLERY
312    -------------------------------------------*/
313    function sortingGallery() {
314        if ($(".sortable-gallery .gallery-filters").length) {
315            var $container = $('.gallery-container');
316            $container.isotope({
317                filter: '*',
318                animationOptions: {
319                    duration: 750,
320                    easing: 'linear',
321                    queue: false,
322                }
323            });
324
325            $(".gallery-filters li a").on("click", function () {
326                $('.gallery-filters li .current').removeClass('current');
327                $(this).addClass('current');
328                var selector = $(this).attr('data-filter');
329                $container.isotope({
330                    filter: selector,
331                    animationOptions: {
332                        duration: 750,
333                        easing: 'linear',
334                        queue: false,
335                    }
336                });
337                return false;
338            });
339        }
340    }
341
342    sortingGallery();
343
344
345    /*------------------------------------------
346        = MASONRY GALLERY SETTING
347    -------------------------------------------*/
348    function masonryGridSetting() {
349        if ($('.masonry-gallery').length) {
350            var $grid = $('.masonry-gallery').masonry({
351                itemSelector: '.grid-item',
352                columnWidth: '.grid-item',
353                percentPosition: true
354            });
355
356            $grid.imagesLoaded().progress(function () {
357                $grid.masonry('layout');
358            });
359        }
360    }
361
362    masonryGridSetting();
363
364    /*------------------------------------------
365      = FUNFACT
366  -------------------------------------------*/
367    if ($(".odometer").length) {
368        $('.odometer').appear();
369        $(document.body).on('appear', '.odometer', function (e) {
370            var odo = $(".odometer");
371            odo.each(function () {
372                var countNumber = $(this).attr("data-count");
373                $(this).html(countNumber);
374            });
375        });
376    }
377
378
379
380    /*------------------------------------------
381        = STICKY HEADER
382    -------------------------------------------*/
383
384    // Function for clone an element for sticky menu
385    function cloneNavForSticyMenu($ele, $newElmClass) {
386        $ele.addClass('original').clone().insertAfter($ele).addClass($newElmClass).removeClass('original');
387    }
388
389    // clone home style 1 navigation for sticky menu
390    if ($('.wpo-site-header .navigation').length) {
391        cloneNavForSticyMenu($('.wpo-site-header .navigation'), "sticky-header");
392    }
393
394    var lastScrollTop = '';
395
396    function stickyMenu($targetMenu, $toggleClass) {
397        var st = $(window).scrollTop();
398        var mainMenuTop = $('.wpo-site-header .navigation');
399
400        if ($(window).scrollTop() > 1000) {
401            if (st > lastScrollTop) {
402                // hide sticky menu on scroll down
403                $targetMenu.removeClass($toggleClass);
404
405            } else {
406                // active sticky menu on scroll up
407                $targetMenu.addClass($toggleClass);
408            }
409
410        } else {
411            $targetMenu.removeClass($toggleClass);
412        }
413
414        lastScrollTop = st;
415
416
417    }
418
419
420
421    /*------------------------------------------
422            = Header search toggle
423        -------------------------------------------*/
424    if ($(".header-search-form-wrapper").length) {
425        var searchToggleBtn = $(".search-toggle-btn");
426        var searchToggleBtnIcon = $(".search-toggle-btn i");
427        var searchContent = $(".header-search-form");
428        var body = $("body");
429
430        searchToggleBtn.on("click", function (e) {
431            searchContent.toggleClass("header-search-content-toggle");
432            searchToggleBtnIcon.toggleClass("fi flaticon-magnifiying-glass fi ti-close");
433            e.stopPropagation();
434        });
435
436        body.on("click", function () {
437            searchContent.removeClass("header-search-content-toggle");
438        }).find(searchContent).on("click", function (e) {
439            e.stopPropagation();
440        });
441    }
442
443
444    /*------------------------------------------
445        = Header header right Menu toggle
446    -------------------------------------------*/
447    if ($(".header-right-menu-wrapper").length) {
448        var cartToggleBtn = $(".right-menu-toggle-btn");
449        var cartContent = $(".header-right-menu-wrap");
450        var cartCloseBtn = $(".right-menu-close");
451        var body = $("body");
452
453        cartToggleBtn.on("click", function (e) {
454            cartContent.toggleClass("right-menu-active");
455            e.stopPropagation();
456        });
457
458        cartCloseBtn.on("click", function (e) {
459            cartContent.removeClass("right-menu-active");
460            e.stopPropagation();
461        });
462
463        body.on("click", function () {
464            cartContent.removeClass("right-menu-active");
465        }).find(cartContent).on("click", function (e) {
466            e.stopPropagation();
467        });
468    }
469
470
471    /*------------------------------------------
472        = Testimonial SLIDER
473    -------------------------------------------*/
474    if ($(".wpo-breacking-wrap").length) {
475        $(".wpo-breacking-wrap").owlCarousel({
476            autoplay: true,
477            smartSpeed: 900,
478            margin: 0,
479            loop: true,
480            autoplayHoverPause: true,
481            dots: false,
482            nav: false,
483            responsive: {
484                0: {
485                    items: 1,
486                    dots: false,
487                    nav: false
488                },
489
490                500: {
491                    items: 1,
492                    dots: false,
493                    nav: false
494                },
495
496                768: {
497                    items: 2,
498                },
499
500                1200: {
501                    items: 3
502                },
503
504                1400: {
505                    items: 3
506                },
507
508            }
509        });
510    }
511
512
513
514    /*------------------------------------------
515        = Testimonial SLIDER
516    -------------------------------------------*/
517    if ($(".wpo-testimonial-slider").length) {
518        $(".wpo-testimonial-slider").owlCarousel({
519            autoplay: false,
520            smartSpeed: 300,
521            margin: 20,
522            loop: true,
523            autoplayHoverPause: true,
524            dots: false,
525            nav: true,
526            navText: ['<i class="ti-arrow-left"></i>', '<i class="ti-arrow-right"></i>'],
527            responsive: {
528                0: {
529                    items: 1,
530                    dots: true,
531                    nav: false
532                },
533
534                500: {
535                    items: 1,
536                    dots: true,
537                    nav: false
538                },
539
540                768: {
541                    items: 2,
542                },
543
544                1200: {
545                    items: 3
546                },
547
548                1400: {
549                    items: 3
550                },
551
552            }
553        });
554    }
555
556
557    /*------------------------------------------
558        = POST SLIDER
559    -------------------------------------------*/
560    if ($(".post-slider".length)) {
561        $(".post-slider").owlCarousel({
562            mouseDrag: false,
563            smartSpeed: 500,
564            margin: 30,
565            loop: true,
566            nav: true,
567            navText: ['<i class="fi ti-arrow-left"></i>', '<i class="fi ti-arrow-right"></i>'],
568            dots: false,
569            items: 1
570        });
571    }
572
573
574    /*------------------------------------------
575        = SHOP DETAILS PAGE PRODUCT SLIDER
576    -------------------------------------------*/
577    if ($(".shop-single-slider").length) {
578        $('.slider-for').slick({
579            slidesToShow: 1,
580            slidesToScroll: 1,
581            arrows: false,
582            fade: true,
583            asNavFor: '.slider-nav'
584        });
585        $('.slider-nav').slick({
586            slidesToShow: 5,
587            slidesToScroll: 1,
588            asNavFor: '.slider-for',
589            focusOnSelect: true,
590            prevArrow: '<i class="nav-btn nav-btn-lt ti-arrow-left"></i>',
591            nextArrow: '<i class="nav-btn nav-btn-rt ti-arrow-right"></i>',
592
593            responsive: [
594                {
595                    breakpoint: 500,
596                    settings: {
597                        slidesToShow: 3,
598                        infinite: true
599                    }
600                },
601                {
602                    breakpoint: 400,
603                    settings: {
604                        slidesToShow: 2
605                    }
606                }
607            ]
608
609        });
610    }
611
612
613    /*------------------------------------------
614        = TOUCHSPIN FOR PRODUCT SINGLE PAGE
615    -------------------------------------------*/
616    if ($("input[name='product-count']").length) {
617        $("input[name='product-count']").TouchSpin({
618            verticalbuttons: true
619        });
620    }
621
622    /*-----------------------
623       cart-plus-minus-button 
624     -------------------------*/
625    $(".cart-plus-minus").append('<div class="dec qtybutton">-</div><div class="inc qtybutton">+</div>');
626    $(".qtybutton").on("click", function () {
627        var $button = $(this);
628        var oldValue = $button.parent().find("input").val();
629        if ($button.text() == "+") {
630            var newVal = parseFloat(oldValue) + 1;
631        } else {
632            // Don't allow decrementing below zero
633            if (oldValue > 0) {
634                var newVal = parseFloat(oldValue) - 1;
635            } else {
636                newVal = 0;
637            }
638        }
639        $button.parent().find("input").val(newVal);
640    });
641
642
643
644    /*------------------------------------------
645       = BACK TO TOP BTN SETTING
646   -------------------------------------------*/
647    $("body").append("<a href='#' class='back-to-top'><i class='ti-arrow-up'></i></a>");
648
649    function toggleBackToTopBtn() {
650        var amountScrolled = 1000;
651        if ($(window).scrollTop() > amountScrolled) {
652            $("a.back-to-top").fadeIn("slow");
653        } else {
654            $("a.back-to-top").fadeOut("slow");
655        }
656    }
657
658    $(".back-to-top").on("click", function () {
659        $("html,body").animate({
660            scrollTop: 0
661        }, 700);
662        return false;
663    })
664
665
666    /*------------------------------------------
667        = CONTACT FORM SUBMISSION
668    -------------------------------------------*/
669    if ($("#contact-form-main").length) {
670        $("#contact-form-main").validate({
671            rules: {
672                name: {
673                    required: true,
674                    minlength: 2
675                },
676
677                email: "required",
678
679                phone: "required",
680
681                subject: {
682                    required: true
683                }
684
685
686            },
687
688            messages: {
689                name: "Please enter your name",
690                email: "Please enter your email address",
691                phone: "Please enter your phone number",
692                subject: "Please select your contact subject"
693            },
694
695            submitHandler: function (form) {
696                $.ajax({
697                    type: "POST",
698                    url: "mail-contact.php",
699                    data: $(form).serialize(),
700                    success: function () {
701                        $("#loader").hide();
702                        $("#success").slideDown("slow");
703                        setTimeout(function () {
704                            $("#success").slideUp("slow");
705                        }, 3000);
706                        form.reset();
707                    },
708                    error: function () {
709                        $("#loader").hide();
710                        $("#error").slideDown("slow");
711                        setTimeout(function () {
712                            $("#error").slideUp("slow");
713                        }, 3000);
714                    }
715                });
716                return false; // required to block normal submit since you used ajax
717            }
718
719        });
720    }
721
722
723
724    /*==========================================================================
725        WHEN DOCUMENT LOADING
726    ==========================================================================*/
727    $(window).on('load', function () {
728
729        preloader();
730
731        masonryGridSetting();
732
733        toggleMobileNavigation();
734
735        smallNavFunctionality();
736
737        sortingGallery();
738
739    });
740
741
742
743    /*==========================================================================
744        WHEN WINDOW SCROLL
745    ==========================================================================*/
746    $(window).on("scroll", function () {
747
748        if ($(".wpo-site-header").length) {
749            stickyMenu($('.wpo-site-header .navigation'), "sticky-on");
750        }
751
752        toggleBackToTopBtn();
753
754    });
755
756
757    /*==========================================================================
758        WHEN WINDOW RESIZE
759    ==========================================================================*/
760    $(window).on("resize", function () {
761        toggleClassForSmallNav();
762        //smallNavFunctionality();
763
764        clearTimeout($.data(this, 'resizeTimer'));
765        $.data(this, 'resizeTimer', setTimeout(function () {
766            smallNavFunctionality();
767        }, 200));
768
769    });
770
771
772    // login
773
774    $(".reveal6").on('click', function () {
775        var $pwd = $(".pwd6");
776        if ($pwd.attr('type') === 'text') {
777            $pwd.attr('type', 'password');
778        } else {
779            $pwd.attr('type', 'text');
780        }
781    });
782
783
784    $(".reveal3").on('click', function () {
785        var $pwd = $(".pwd2");
786        if ($pwd.attr('type') === 'text') {
787            $pwd.attr('type', 'password');
788        } else {
789            $pwd.attr('type', 'text');
790        }
791    });
792
793    $(".reveal2").on('click', function () {
794        var $pwd = $(".pwd3");
795        if ($pwd.attr('type') === 'text') {
796            $pwd.attr('type', 'password');
797        } else {
798            $pwd.attr('type', 'text');
799        }
800    });
801
802
803
804})(window.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.