/*--------------------- Copyright (c) 2018 -----------------------
[Master Javascript]
Project: The Foodiee -  HTML Template
Version: 1.0.0
Assigned to: Theme Forest
-------------------------------------------------------------------*/
(function($) {
    "use strict";
    var foodiee = {
        initialised: false,
        version: 1.0,
        mobile: false,
        init: function() {
            if (!this.initialised) {
                this.initialised = true;
            } else {
                return;
            }
            /*-------------- Foodiee Functions Calling ---------------------------------------------------
            ------------------------------------------------------------------------------------------------*/
            this.RTL();
            this.Search();
			this.Popup();
            this.Menu();
            this.Togglemenu();
            this.Mainslider();
            this.Homeslider();
            this.Scrolldown();
            this.Custom_select();
            this.Datetimepicker();
            this.Slider();
            this.Video();
            this.Gallery();
            this.Book_table();
            this.Quantity();
            this.Rangeslider();
        },
        /*-------------- Foodiee Functions definition ---------------------------------------------------
        ---------------------------------------------------------------------------------------------------*/
        RTL: function() {
            var rtl_attr = $("html").attr('dir');
            if (rtl_attr) {
                $('html').find('body').addClass("rtl");
            }
        },
        // Search
        Search: function() {
            if ($(window).width() <= 992) {
                $(".fd_srch_icon img").on('click', function() {
                    $('.fd_search').addClass('open_search');
                })
                $(".fd_ovrly_close").on('click', function() {
                    $('.fd_search').removeClass('open_search');
                })
            } else {
            }
        },
		// Popup
		Popup: function(){
			$('.hideCurrentModel').on('click', function() {
                $(this).closest('.modal-content').find('.form_close').trigger('click');
            });
			
		},
		
		
        // Menu		
        Menu: function() {
            $('.sub-menu').parent().hover(function() {
                var menu = $(this).find("ul");
                var menupos = $(menu).offset();
                if (menupos.left + menu.width() > $(window).width()) {
                    var newpos = -$(menu).width();
                    menu.css({
                        left: newpos
                    });
                }
            });
        },
        // Toggle Menu
        Togglemenu: function() {
            if ($(window).width() <= 992) {
                $(".fd_menu_toggle").on('click', function() {
                    $(".fd_menu_wrapper").toggleClass('open_menu');
                });
                $(".fd_menu_cls").on('click', function() {
                    $(".fd_menu_wrapper").removeClass('open_menu');
                });
                $('.fd_menu ul li.dropdown').children('a').append(function() {
                    return '<div class="dropdown-expander"><i class="fa fa-angle-down" aria-hidden="true"></i></div>';
                });
                $(".fd_menu ul > li:has(ul) > a").on('click', function(e) {
                    var w = window.innerWidth;
                    if (w <= 991) {
                        e.preventDefault();
                        $(this).parent('.fd_menu ul li').children('ul.sub-menu').slideToggle();
                    }
                });
            }
        },
        // Main Slider
        Mainslider: function() {
            if ($('.fd_main_slider').length > 0) {
                var tpj = jQuery;
                var revapi1068;
                tpj(document).ready(function() {
                    if (tpj("#rev_slider_1068_1").revolution == undefined) {
                        revslider_showDoubleJqueryError("#rev_slider_1068_1");
                    } else {
                        revapi1068 = tpj("#rev_slider_1068_1").show().revolution({
                            sliderType: "standard",
                            jsFileLocation: "revolution/js/",
                            sliderLayout: "fullscreen",
                            dottedOverlay: "none",
                            delay: 9000,
                            navigation: {
                                keyboardNavigation: "off",
                                keyboard_direction: "horizontal",
                                mouseScrollNavigation: "off",
                                mouseScrollReverse: "default",
                                onHoverStop: "on",
                                touch: {
                                    touchenabled: "on",
                                    swipe_threshold: 75,
                                    swipe_min_touches: 1,
                                    swipe_direction: "vertical",
                                    drag_block_vertical: false
                                },
                                bullets: {
                                    enable: false,
                                    hide_onmobile: true,
                                    hide_under: 1024,
                                    style: "uranus",
                                    hide_onleave: false,
                                    direction: "vertical",
                                    h_align: "right",
                                    v_align: "center",
                                    h_offset: 30,
                                    v_offset: 0,
                                    space: 5,
                                    tmp: '<span class="tp-bullet-inner"></span>'
                                }
                            },
                            viewPort: {
                                enable: true,
                                outof: "wait",
                                visible_area: "80%",
                                presize: false
                            },
                            responsiveLevels: [1240, 1024, 768, 480],
                            visibilityLevels: [1240, 1024, 768, 480],
                            gridwidth: [1240, 1024, 778, 480],
                            gridheight: [868, 768, 960, 720],
                            lazyType: "single",
                            shadow: 0,
                            spinner: "off",
                            stopLoop: "on",
                            stopAfterLoops: 2,
                            stopAtSlide: 2,
                            shuffle: "off",
                            autoHeight: "off",
                            fullScreenAutoWidth: "off",
                            fullScreenAlignForce: "off",
                            fullScreenOffsetContainer: ".header",
                            fullScreenOffset: "",
                            disableProgressBar: "on",
                            hideThumbsOnMobile: "off",
                            hideSliderAtLimit: 0,
                            hideCaptionAtLimit: 0,
                            hideAllCaptionAtLilmit: 0,
                            debugMode: false,
                            fallbacks: {
                                simplifyAll: "off",
                                nextSlideOnWindowFocus: "off",
                                disableFocusListener: false,
                            }
                        });
                    }
                }); /*ready*/
            }
        },
        // Home Slider
        Homeslider: function() {
            if ($('.fd_home_slider .fd_main_slider').length > 0) {
                var tpj = jQuery;
                var revapi1061;
                tpj(document).ready(function() {
                    if (tpj("#rev_slider_1061_1").revolution == undefined) {
                        revslider_showDoubleJqueryError("#rev_slider_1061_1");
                    } else {
                        revapi1061 = tpj("#rev_slider_1061_1").show().revolution({
                            sliderType: "default",
                            jsFileLocation: "revolution/js/",
                            sliderLayout: "fullscreen",
                            dottedOverlay: "none",
                            delay: 9000,
                            navigation: {
                                keyboardNavigation: "off",
                                keyboard_direction: "horizontal",
                                mouseScrollNavigation: "off",
                                mouseScrollReverse: "default",
                                onHoverStop: "off",
                                touch: {
                                    touchenabled: "on",
                                    swipe_threshold: 75,
                                    swipe_min_touches: 50,
                                    swipe_direction: "horizontal",
                                    drag_block_vertical: false
                                },
                                // tabs: {
                                    // style: "metis",
                                    // enable: true,
                                    // width: 100,
                                    // height: 50,
                                    // min_width: 150,
                                    // wrapper_padding: 0,
                                    // wrapper_color: "",
                                    // wrapper_opacity: "0",
                                    // tmp: '<div class="tp-tab-wrapper"><div class="tp-tab-number">{{param1}}</div><div class="tp-tab-divider"></div><div class="tp-tab-title-mask"><div class="tp-tab-title">{{title}}</div></div></div>',
                                    // visibleAmount: 2,
                                    // hide_onmobile: true,
                                    // hide_under: 800,
                                    // hide_onleave: false,
                                    // hide_delay: 200,
                                    // direction: "vertical",
                                    // span: true,
                                    // position: "inner",
                                    // space: 0,
                                    // h_align: "right",
                                    // v_align: "center",
                                    // h_offset: 0,
                                    // v_offset: 0
                                // }
                            },
                            responsiveLevels: [1240, 1024, 778, 480],
                            visibilityLevels: [1240, 1024, 778, 480],
                            gridwidth: [1240, 1024, 778, 480],
                            gridheight: [868, 768, 960, 720],
                            lazyType: "none",
                            spinner: "off",
                            stopLoop: "on",
                            stopAfterLoops: 0,
                            stopAtSlide: 1,
                            shuffle: "off",
                            autoHeight: "off",
                            fullScreenAutoWidth: "off",
                            fullScreenAlignForce: "off",
                            fullScreenOffsetContainer: "",
                            fullScreenOffset: "60px",
                            disableProgressBar: "on",
                            hideThumbsOnMobile: "off",
                            hideSliderAtLimit: 0,
                            hideCaptionAtLimit: 0,
                            hideAllCaptionAtLilmit: 0,
                            debugMode: false,
                            fallbacks: {
                                simplifyAll: "off",
                                nextSlideOnWindowFocus: "off",
                                disableFocusListener: false,
                            }
                        });
                    }
                }); /*ready*/
            }
        },
        // Scroll Down
        Scrolldown: function() {
            $(".rev-scroll-btn").on("click", function() {
                var i = $($(this).attr("data-target"))[0].clientHeight;
                $("html,body").animate({
                    scrollTop: i
                }, 500)
            })
        },
        // Nice Select
        Custom_select: function() {
            $('.cusom_select').niceSelect();
        },
        // Datetimepicker
        Datetimepicker: function() {
            $('.datepicker').datepicker({
				format: 'dd-M-yyyy',
				startDate: '+0d',
				 
			});
			
            // Timepicker	
            $('.timepicker').timepicker();
		},
        // Slider 
        Slider:function() {
            // Top Offer Slider
            var swiper = new Swiper('.top_offer .swiper-container', {
                direction: 'vertical',
                freeMode: true,
                autoHeight: true,
                loop: true,
                autoplay: true,
                slidesPerView: 1,
                speed: 1000,
                navigation: {
                    nextEl: '.swiper-button-next',
                    prevEl: '.swiper-button-prev',
                },
            })
            // Testimonial Slider
            var swiper = new Swiper('.fd_test_slider .swiper-container', {
                slidesPerView: 1,
                loop: true,
                autoplay: false,
                speed: 1500,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next',
                    prevEl: '.swiper-button-prev',
                },
            });
            // Blog Slider
            var swiper = new Swiper('.fd_blog_slider .swiper-container', {
                slidesPerView: 2,
                loop: true,
                autoplay: false,
                speed: 1500,
                spaceBetween: 30,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next3',
                    prevEl: '.swiper-button-prev3',
                },
                breakpoints: {
                    991: {
                        slidesPerView: 1,
                        spaceBetween: 0,
                    },
                    768: {
                        slidesPerView: 1,
                        spaceBetween: 0,
                    },
                    640: {
                        slidesPerView: 1,
                        spaceBetween: 15,
                    },
                    480: {
                        slidesPerView: 1,
                    },
                    375: {
                        slidesPerView: 1,
                        spaceBetween: 0,
                    }
                },
            });
            // Partner Slider
            var swiper = new Swiper('.fd_partner_slider .swiper-container', {
                slidesPerView: 6,
                loop: true,
                autoplay: false,
                speed: 1500,
                spaceBetween: 30,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next4',
                    prevEl: '.swiper-button-prev4',
                },
                breakpoints: {
                    992: {
                        slidesPerView: 5,
                        spaceBetween: 10,
                    },
                    768: {
                        slidesPerView: 3,
                        spaceBetween: 10,
                    },
                    640: {
                        slidesPerView: 3,
                        spaceBetween: 15,
                    },
                    480: {
                        slidesPerView: 1,
                    },
                    375: {
                        slidesPerView: 1,
                        spaceBetween: 0,
                    }
                },
            });
            // Partner Slider
            var swiper = new Swiper('.fd_team_slider .swiper-container', {
                slidesPerView: 4,
                loop: true,
                autoplay: false,
                speed: 1500,
                spaceBetween: 30,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next5',
                    prevEl: '.swiper-button-prev5',
                },
                breakpoints: {
                    992: {
                        slidesPerView: 3,
                        spaceBetween: 10,
                    },
                    768: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    640: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    480: {
                        slidesPerView: 1,
                    },
                    375: {
                        slidesPerView: 1,
                        spaceBetween: 0,
                    }
                },
            });
            // Reservation Slider
            var swiper = new Swiper('.fd_book_time_list .swiper-container', {
                slidesPerView: 5,
                loop: true,
                autoplay: true,
                speed: 1500,
                spaceBetween: 0,
                direction: 'vertical',
                pagination: {
                    el: '.swiper-pagination',
                },
            });
            // Reservation Slider
            var swiper = new Swiper('.fd_book_table_slider.swiper-container', {
                slidesPerView: 1,
                loop: true,
                autoplay: false,
                speed: 1500,
                spaceBetween: 0,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next13',
                    prevEl: '.swiper-button-prev13',
                },
            });
            // Single Blog Slider
            var swiper = new Swiper('.fd_blog_single_slider .swiper-container', {
                slidesPerView: 1,
                loop: true,
                autoplay: false,
                speed: 1500,
                spaceBetween: 0,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next11',
                    prevEl: '.swiper-button-prev11',
                },
            });
            // Advertisement Slider Start
            var swiper = new Swiper('.fd_adv_slider .swiper-container', {
                slidesPerView: 1,
                loop: true,
                autoplay: false,
                speed: 1500,
                spaceBetween: 0,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next12',
                    prevEl: '.swiper-button-prev12',
                },
            });
            // Recent Viewed  Slider
            var swiper = new Swiper('.fd_recent_slider.swiper-container', {
                slidesPerView: 4,
                loop: false,
                autoplay: false,
                speed: 1500,
                spaceBetween: 30,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next14',
                    prevEl: '.swiper-button-prev14',
                },
                breakpoints: {
                    992: {
                        slidesPerView: 3,
                        spaceBetween: 10,
                    },
                    768: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    640: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    480: {
                        slidesPerView: 1,
                    },
                    375: {
                        slidesPerView: 1,
                        spaceBetween: 0,
                    }
                },
            });
            // Shop Single Slider
         /*   if ($('.fd_single_pro_slider').length>0) {
                var galleryTop = new Swiper('.swiper-container.gallery-top', {
                    spaceBetween: 0,
                    loop: !0,
                    effect: "fade",
                    loopedSlides: 4,
                    navigation: {
                        nextEl: ".swiper-button-next",
                        prevEl: ".swiper-button-prev"
                    }
                });
                var galleryThumbs = new Swiper('.swiper-container.gallery-thumbs', {
                    direction: "vertical",
                    spaceBetween: 0,
                    slidesPerView: 4,
                    loop: !0,
                    loopedSlides: 4,
                    centeredSlides: !1,
                    mousewheel: !0,
                    slideToClickedSlide: !0,
                    breakpoints: {
                        1400: {
                            direction: "vertical"
                        },
                        1199: {
                            direction: "vertical"
                        },
                        991: {
                            direction: "vertical"
                        },
                        768: {
                            direction: "vertical",
                            slidesPerView: 3,
                            spaceBetween: 10,
                        },
                        767: {
                            direction: "vertical",
                            slidesPerView: 3,
                        },
                        575: {
                            direction: "horizontal",
                            slidesPerView: 3,
                        },
                        375: {
                            direction: "horizontal",
                            slidesPerView: 2,
                        }
                    }
                });
                galleryTop.controller.control = galleryThumbs;
                galleryThumbs.controller.control = galleryTop;
            } */
            // About Slider
            var swiper = new Swiper('.about_slider.swiper-container', {
                slidesPerView: 1,
                loop: true,
                autoplay: false,
                speed: 1500,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next22',
                    prevEl: '.swiper-button-prev22',
                },
            });
            // Menu Slider1 For Breakfast
            var swiper = new Swiper('.fd_food_menu1.swiper-container', {
                slidesPerView: 4,
                slidesPerColumn: 2,
                spaceBetween: 30,
                loop: true,
                autoplay: false,
                speed: 1500,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next2',
                    prevEl: '.swiper-button-prev2',
                },
                breakpoints: {
                    992: {
                        slidesPerView: 3,
                        spaceBetween: 10,
                    },
                    768: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    640: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    480: {
                        slidesPerView: 1,
                    },
                    375: {
                        slidesPerView: 1,
                        spaceBetween: 0,
                    }
                },
            });
            // Menu Slider2 For Lunch
            var swiper = new Swiper('.fd_food_menu2.swiper-container', {
                slidesPerView: 4,
                slidesPerColumn: 2,
                spaceBetween: 30,
                loop: false,
                autoplay: false,
                speed: 1500,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next6',
                    prevEl: '.swiper-button-prev6',
                },
                breakpoints: {
                    992: {
                        slidesPerView: 3,
                        spaceBetween: 10,
                    },
                    768: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    640: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    480: {
                        slidesPerView: 1,
                    },
                    375: {
                        slidesPerView: 1,
                        spaceBetween: 0,
                    }
                },
            });
            // Menu Slider3 For Dessert
            var swiper = new Swiper('.fd_food_menu3.swiper-container', {
                slidesPerView: 4,
                slidesPerColumn: 2,
                spaceBetween: 30,
                loop: true,
                autoplay: false,
                speed: 1500,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next7',
                    prevEl: '.swiper-button-prev7',
                },
                breakpoints: {
                    992: {
                        slidesPerView: 3,
                        spaceBetween: 10,
                    },
                    768: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    640: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    480: {
                        slidesPerView: 1,
                    },
                    375: {
                        slidesPerView: 1,
                        spaceBetween: 0,
                    }
                },
            });
            // Menu Slider4 For Dinner
            var swiper = new Swiper('.fd_food_menu4.swiper-container', {
                slidesPerView: 4,
                slidesPerColumn: 2,
                spaceBetween: 30,
                loop: true,
                autoplay: false,
                speed: 1500,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next8',
                    prevEl: '.swiper-button-prev8',
                },
                breakpoints: {
                    992: {
                        slidesPerView: 3,
                        spaceBetween: 10,
                    },
                    768: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    640: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    480: {
                        slidesPerView: 1,
                    },
                    375: {
                        slidesPerView: 1,
                        spaceBetween: 0,
                    }
                },
            });
            // Menu Slider5 For Fresh Food
            var swiper = new Swiper('.fd_food_menu5.swiper-container', {
                slidesPerView: 4,
                slidesPerColumn: 2,
                spaceBetween: 30,
                loop: true,
                autoplay: false,
                speed: 1500,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next9',
                    prevEl: '.swiper-button-prev9',
                },
                breakpoints: {
                    992: {
                        slidesPerView: 3,
                        spaceBetween: 10,
                    },
                    768: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    640: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    480: {
                        slidesPerView: 1,
                    },
                    375: {
                        slidesPerView: 1,
                        spaceBetween: 0,
                    }
                },
            });
        },
        // Magnific Vedio
        Video: function() {
            $('.popup-youtube').magnificPopup({
                disableOn: 700,
                type: 'iframe',
                mainClass: 'mfp-fade',
                removalDelay: 160,
                preloader: false,
                fixedContentPos: false
            });
        },
        // Masonry Gallery
        Gallery: function() {
            $('.fd_gal_wrapper').magnificPopup({
                delegate: 'a',
                type: 'image',
                mainClass: 'mfp-with-zoom',
                gallery: {
                    enabled: true,
                },
            });
        },
        // Book Table
        Book_table: function() {
            $('.fd_table_box > ul > li').on('click', function() {
                $(this).addClass('table_active')
            });
            // Scroll
            $(".fd_table_box > ul > li").on("click", function() {
                var i = $(this).clientHeight;
                $("html,body").animate({
                    scrollTop: i
                }, 500)
            })
        },
        // Quantity Input
        Quantity: function() {
            var quantitiy = 0;
            $('.quantity-right-plus').click(function(e) {
                e.preventDefault();
                var quantity = parseInt($('.quantity').val());
                $('.quantity').val(quantity + 1);
            });
            $('.quantity-left-minus').click(function(e) {
                e.preventDefault();
                var quantity = parseInt($('.quantity').val());
                if (quantity > 1) {
                    $('.quantity').val(quantity - 1);
                }
            });
        },
        // Range Slider
        Rangeslider: function() {
			if ($('#slider-range').length > 0) {
            $('#price-range-submit').hide();
            $("#min_price,#max_price").on('change', function() {
                $('#price-range-submit').show();
                var min_price_range = parseInt($("#min_price").val());
                var max_price_range = parseInt($("#max_price").val());
                if (min_price_range > max_price_range) {
                    $('#max_price').val(min_price_range);
                }
                $("#slider-range").slider({
                    values: [min_price_range, max_price_range]
                });
            });
            $("#min_price,#max_price").on("paste keyup", function() {
                $('#price-range-submit').show();
                var min_price_range = parseInt($("#min_price").val());
                var max_price_range = parseInt($("#max_price").val());
                if (min_price_range == max_price_range) {
                    max_price_range = min_price_range + 100;
                    $("#min_price").val(min_price_range);
                    $("#max_price").val(max_price_range);
                }
                $("#slider-range").slider({
                    values: [min_price_range, max_price_range]
                });
            });
            $(function() {
                $("#slider-range").slider({
                    range: true,
                    orientation: "horizontal",
                    min: 0,
                    max: 10000,
                    values: [0, 10000],
                    step: 100,
                    slide: function(event, ui) {
                        if (ui.values[0] == ui.values[1]) {
                            return false;
                        }
                        $("#min_price").val(ui.values[0]);
                        $("#max_price").val(ui.values[1]);
                    }
                });
                $("#min_price").val($("#slider-range").slider("values", 0));
                $("#max_price").val($("#slider-range").slider("values", 1));
            });
            $("#slider-range,#price-range-submit").click(function() {
                var min_price = $('#min_price').val();
                var max_price = $('#max_price').val();
                $("#searchResults").text("Here List of products will be shown which are cost between " + min_price + " " + "and" + " " + max_price + ".");
            });
        }
		}
    };
    $(document).ready(function() {
        foodiee.init();
		$('.fd_menu ul li a').click(function(){
			$(this).parents().find('ul li.active').removeClass("active");
			$(this).closest('li').addClass("active");
		});
        // Menu Slider 1
        var swiper = function() {
            new Swiper('.fd_food_menu .swiper-container', {
                slidesPerView: 4,
                slidesPerColumn: 2,
                spaceBetween: 30,
                loop: false,
                autoplay: false,
                speed: 1500,
                pagination: false,
                navigation: {
                    nextEl: '.swiper-button-next',
                    prevEl: '.swiper-button-prev',
                },
                breakpoints: {
                    992: {
                        slidesPerView: 3,
                        spaceBetween: 10,
                    },
                    768: {
                        slidesPerView: 2,
                        spaceBetween: 10,
                    },
                    640: {
                        slidesPerView: 1,
                        spaceBetween: 0,
                    },
                    480: {
                        slidesPerView: 1,
                        spaceBetween: 0,
                    },
                    375: {
                        slidesPerView: 1,
                        spaceBetween: 0,
                    }
                },
            });
        }
        swiper();
        $(document).on("click", ".fd_food_tab ul.nav li a", function() {
            setTimeout(function() {
                swiper();
            }, 200);
        });
		// Scrollbar
		if ($(window).width() <= 992) {
		$(".fd_menu").CustomScrollbar({
			theme:"minimal"
		});
		}
		
		
    });
    // Preloader Js
    jQuery(window).on('load', function() {
        setTimeout(function() {
            $('body').addClass('loaded');
        });
        // Gallery
        var $grid = $('.grid').isotope({
            itemSelector: '.element-item',
            percentPosition: true,
            masonry: {
                columnWidth: '.grid-sizer'
            }
        });
    });
    // Window Scroll
    $(window).scroll(function() {
        var wh = window.innerWidth;
        //Go to top
        if ($(this).scrollTop() > 100) {
            $('.gotop').addClass('goto');
        } else {
            $('.gotop').removeClass('goto');
        }
    });
    $(".fd_btm_arrow").on("click", function() {
        $("html, body").animate({
            scrollTop: 0
        }, 600);
        return false
    });
})(jQuery);

  
