jQuery(document).ready(function(){
    var swiper = new Swiper(".singleProductSwiper", {
        loop: true,
        spaceBetween: 10,
        slidesPerView: 3,
        freeMode: true,
        watchSlidesProgress: true,
    });
    var swiper2 = new Swiper(".singleProductSwiperThumb", {
        loop: true,
        spaceBetween: 10,
        navigation: {
            nextEl: ".swiper-button-next",
            prevEl: ".swiper-button-prev",
        },
        thumbs: {
            swiper: swiper,
        },
    });
    jQuery('form.cart').on('click', 'button.plus, button.minus', function() {
        var qty = jQuery( this ).closest( 'form.cart' ).find( '.qty' );
        var val   = parseFloat(qty.val());
        var max = parseFloat(qty.attr( 'max' ));
        var min = parseFloat(qty.attr( 'min' ));
        var step = parseFloat(qty.attr( 'step' ));
        if ( jQuery( this ).is( '.plus' ) ) {
            if ( max && ( max <= val ) ) {
                qty.val( max );
            } 
        else {
            qty.val( val + step );
                }
        } 
        else {
            if ( min && ( min >= val ) ) {
                qty.val( min );
            } 
            else if ( val > 1 ) {
                qty.val( val - step );
            }
        }
    });
});
