$(document).ready(function() {
    //editButton
    $(`#editButton`).click(function() {
        $(`.profile_pg .profile_tab .data_tab`).hide();
        $(`.profile_pg .profile_tab .editData_box`).css("display", "block");
    });

    var wind = $(window);

    wow = new WOW({
        boxClass: 'wow',
        animateClass: 'animated',
        offset: 200,
        mobile: false,
        live: false
    });
    wow.init();




    // ---------- to top -----------
    $('.to-top').click(function() {
        $('html, body').animate({
            scrollTop: 0
        }, 1000);
        return false;
    });


        // share_links in product detils page
        $(`.share_butn`).click(function() {
            $(this).parent().find('.share_links').toggleClass(`active`);
        });
    
        
});


// ------------ swiper sliders -----------
$(document).ready(function() {


    // ------------ header_slider -----------
    var swiper = new Swiper('.header_slider', {
        slidesPerView: 1,
        spaceBetween: 0,
        centeredSlides: true,
        speed: 500,
        effect: "fade",
        pagination: {
            el: '.header_slider .swiper-pagination',
            clickable: true,
        },
        navigation: {
            nextEl: '.header_slider .swiper-button-next',
            prevEl: '.header_slider .swiper-button-prev',
        },
        mousewheel: false,
        keyboard: true,
        autoplay: {
            delay: 5000,
        },
        loop: true,
    });


    // ------------ partners_slider -----------
    var swiper = new Swiper('.partners_slider', {
        slidesPerView: 4,
        spaceBetween: 30,
        speed: 1000,
        pagination: false,
        navigation: false,
        mousewheel: false,
        keyboard: true,
        autoplay: {
            delay: 5000,
        },
        loop: true,
        breakpoints: {
            0: {
                slidesPerView: 1,
            },
            480: {
                slidesPerView: 2,
            },
            787: {
                slidesPerView: 3,
            },
            991: {
                slidesPerView: 4,
            },
            1200: {
                slidesPerView: 4,
            }
        }
    });


    // ------------ projects_slider -----------
    var swiper = new Swiper('.projects_slider', {
        slidesPerView: 2,
        spaceBetween: 0,
        speed: 1000,
        pagination: false,
        navigation: {
            nextEl: '.projects_slider .swiper-button-next',
            prevEl: '.projects_slider .swiper-button-prev',
        },
        mousewheel: false,
        keyboard: true,
        autoplay: {
            delay: 5000,
        },
        loop: true,
        breakpoints: {
            0: {
                slidesPerView: 1,
            },
            480: {
                slidesPerView: 1,
            },
            787: {
                slidesPerView: 2,
            },
            991: {
                slidesPerView: 2,
            },
            1200: {
                slidesPerView: 2,
            }
        }
    });


    // ------------ proj_swiper -----------
    var swiper = new Swiper('.proj_det_pg .proj_swiper', {
        slidesPerView: 1,
        spaceBetween: 0,
        speed: 1000,
        pagination: false,
        navigation: {
            nextEl: '.proj_det_pg .swiper-button-next',
            prevEl: '.proj_det_pg .swiper-button-prev',
        },
        pagination: {
            el: '.proj_det_pg .swiper-pagination',
            clickable: true
        },
        mousewheel: false,
        keyboard: true,
        // autoplay: {
        //     delay: 5000,
        // },
        loop: true,
    });

});


$(document).ready(function() {
    // -------- counter --------
    $('.counter').countUp({
        delay: 10,
        time: 2000
    });
})


// ------------ imagePreview -----------
$(document).ready(function() {
    function readURL(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();
            reader.onload = function(e) {
                $('#imagePreview').css('background-image', 'url(' + e.target.result + ')');
                $('#imagePreview').hide();
                $('#imagePreview').fadeIn(650);
            }
            reader.readAsDataURL(input.files[0]);
        }
    }
    $("#imageUpload").change(function() {
        readURL(this);
    });
});

