jQuery(document).ready(function(jQuery) {

    if(jQuery('.main-header li.dropdown ul').length){

        jQuery('.main-header li.dropdown').append('<div class="dropdown-btn"><span class="fa fa-angle-down"></span></div>');
        
        //Dropdown Button
        jQuery('.main-header li.dropdown .dropdown-btn').on('click', function() {
            jQuery(this).prev('ul').slideToggle(500);
        });
        
        
        //Disable dropdown parent link
        jQuery('.navigation li.dropdown > a').on('click', function(e) {
            e.preventDefault();
        });
    }  
    

    /**
     * Testimonials
     */
    jQuery(".kc-testimonials").lightSlider({
        item:3,
        pager:true,
        loop:true,
        speed:600,
        controls:false,
        slideMargin:20,
        auto:false,
        pauseOnHover:true,
        onSliderLoad: function() {
            jQuery('.kc-testimonials').removeClass('cS-hidden');
        },
        responsive : [
            {
                breakpoint:800,
                settings: {
                    item:2,
                    slideMove:1,
                    slideMargin:6,
                  }
            },
            {
                breakpoint:480,
                settings: {
                    item:1,
                    slideMove:1,
                  }
            }
        ]
    });

    /**
     * Our Team Member
     */

    var teamcolumn = kingcabs_ajax_script.teamcolumn;

    jQuery(".team-carousel").lightSlider({
        item: teamcolumn ,
        pager:false,
        loop:true,
        speed:600,
        controls:true,
        slideMargin:20,
        auto:false,
        pauseOnHover:true,
        onSliderLoad: function() {
            jQuery('.team-carousel').removeClass('cS-hidden');
        },
        responsive : [
            {
                breakpoint:800,
                settings: {
                    item:2,
                    slideMove:1,
                    slideMargin:6,
                  }
            },
            {
                breakpoint:480,
                settings: {
                    item:1,
                    slideMove:1,
                  }
            }
        ]
    });


    /**
     * Our Client/Brand Logo
     */
    jQuery(".happy-clients").lightSlider({
        item:4,
        pager:false,
        loop:true,
        speed:600,
        controls:false,
        slideMargin:20,
        auto:true,
        pauseOnHover:true,
        onSliderLoad: function() {
            jQuery('.team-carousel').removeClass('cS-hidden');
        },
        responsive : [
            {
                breakpoint:800,
                settings: {
                    item:2,
                    slideMove:1,
                    slideMargin:6,
                  }
            },
            {
                breakpoint:480,
                settings: {
                    item:1,
                    slideMove:1,
                  }
            }
        ]
    });


    /**
     * Init Counter 
    */
    jQuery('.counter').counterUp({ delay: 4, time: 1000 });(jQuery);


    /**
     * Scroll To Top
    */
    jQuery(window).scroll(function() {
        if (jQuery(this).scrollTop() > 100) {
            jQuery('.scroll-top').fadeIn();
        } else {
            jQuery('.scroll-top').fadeOut();
        }
    });

    //Click event to scroll to top
    jQuery('.scroll-top').click(function() {
        jQuery('html, body').animate({ scrollTop: 0 }, 900);
        return false;
    });

    /**
     * Isotop Active
    */
    if (jQuery.fn.isotope) {
        jQuery(".isotop-active").isotope({
            filter: '*',
        });

            jQuery('.gallery-nav ul li').on('click', function() {
            jQuery(".gallery-nav ul li").removeClass("active");
            jQuery(this).addClass("active");

            var selector = jQuery(this).attr('data-filter');
            jQuery(".isotop-active").isotope({
                filter: selector,
                animationOptions: {
                    duration: 750,
                    easing: 'easeInOutQuart',
                    queue: false,
                }
            });
            return false;
        });
    }

});

jQuery(window).on('load', function() {  

    var offset = 1000,
    offset_opacity = 1200,
    scroll_top_duration = 500, //grab the "back to top" link
    jQueryback_to_top = jQuery('.scroll-top');

    //hide or show the "back to top" link
    jQuery(window).on('scroll', function() {
        (jQuery(this).scrollTop() > offset) ? jQueryback_to_top.addClass('scroll-top-visible'): jQueryback_to_top.removeClass('scroll-top-visible scroll-top-fade-out');
    if (jQuery(this).scrollTop() > offset_opacity) {
        jQueryback_to_top.addClass('scroll-top-fade-out');
    }
});

});(jQuery);