const navbar = document.querySelector('#stikyNav');
//let top = navbar.offsetTop;
function stickynavbar() {
  if (window.scrollY >= 200) {    
    navbar.classList.add('sticky');
  } else {
    navbar.classList.remove('sticky');    
  }
}
  window.addEventListener('scroll', stickynavbar);


  $('.counter-count').each(function () {
    $(this).prop('Counter',0).animate({
        Counter: $(this).text()
    }, {
        duration: 5000,
        easing: 'swing',
        step: function (now) {
            $(this).text(Math.ceil(now));
        }
    });
});



$(document).ready(function(){
    
    $('#clickTop').hide();
    
    //Check to see if the window is top if not then display button
    
    $(window).scroll(function(){
        if ($(this).scrollTop() > 300) {
            $('#clickTop').fadeIn();
        } else {
            $('#clickTop').fadeOut();
        }
    });
    
    //Click event to scroll to top
    
    $('#clickTop').click(function(){
        $('html, body').animate({scrollTop : 0},500);
        return false;
    });
    
});



const counters = document.querySelectorAll(".counter");

counters.forEach((counter) => {
  counter.innerText = "0";
  const updateCounter = () => {
    const target = +counter.getAttribute("data-target");
    const count = +counter.innerText;
    const increment = target / 200;
    if (count < target) {
      counter.innerText = `${Math.ceil(count + increment)}`;
      setTimeout(updateCounter, 1);
    } else counter.innerText = target;
  };
  updateCounter();
});




// $('#owl-carousel').owlCarousel({
//     loop: false,
//     margin: 30,
//     dots: false,
//     nav: true,
//     items: 6,
//     navText: ["<i class='fa fa-angle-left'></i>","<i class='fa fa-angle-right'></i>"],
//     autoplay:true,
   
//     loop: true,
//     responsive:{
//       0:{
//           items:2,
         
//       },
//       767:{
//           items:3,
         
//       },
//       991:{
//           items:3,
          
//       },
  
//       992:{
//           items:3,
          
//       },
  
//       1200:{
//           items:4,
          
//       },
      
//       1366:{
//           items:6,
         
//       },
//       1920:{
//           items:6,
          
//       }
//     }
    
    
    
//   })


  $('#owl-carousel_tab').owlCarousel({
    loop: true,
    margin: 20,
    dots: false,
    nav: false,
    items:1,
    loop:true,
    stagePadding: 200,
    autoplay:true,
    // navText: ["<i class='fa fa-long-arrow-left'></i>","<i class='fa fa-long-arrow-right'></i>"],
    responsive: {
      0: {
          stagePadding: 0
      },
      1000: {
          stagePadding: 200
      }
  }
})

$('#owl-carousel_tab2').owlCarousel({
  loop: true,
  margin: 20,
  dots: false,
  nav: false,
  items:1,
  loop:true,
  stagePadding: 200,
  autoplay:true,
  // navText: ["<i class='fa fa-long-arrow-left'></i>","<i class='fa fa-long-arrow-right'></i>"],
  responsive: {
    0: {
        stagePadding: 0
    },
    1000: {
        stagePadding: 200
    }
}
})

$('#owl-carousel_tab3').owlCarousel({
  loop: true,
  margin: 20,
  dots: false,
  nav: false,
  items:1,
  loop:true,
  stagePadding: 200,
  autoplay:true,
  // navText: ["<i class='fa fa-long-arrow-left'></i>","<i class='fa fa-long-arrow-right'></i>"],
  responsive: {
    0: {
        stagePadding: 0
    },
    1000: {
        stagePadding: 200
    }
}
})

$('#owl-carousel_tab_a').owlCarousel({
  loop: true,
  margin: 20,
  dots: false,
  nav: false,
  items:1,
  loop:true,
  stagePadding: 200,
  autoplay:true,
  // navText: ["<i class='fa fa-long-arrow-left'></i>","<i class='fa fa-long-arrow-right'></i>"],
  responsive: {
    0: {
        stagePadding: 0
    },
    1000: {
        stagePadding: 200
    }
}
})

$('#owl-carousel_tab_b').owlCarousel({
  loop: true,
  margin: 20,
  dots: false,
  nav: false,
  items:1,
  loop:true,
  stagePadding: 200,
  autoplay:true,
  // navText: ["<i class='fa fa-long-arrow-left'></i>","<i class='fa fa-long-arrow-right'></i>"],
  responsive: {
    0: {
        stagePadding: 0
    },
    1000: {
        stagePadding: 200
    }
}
})

$('#owl-carousel_tab_c').owlCarousel({
  loop: true,
  margin: 20,
  dots: false,
  nav: false,
  items:1,
  loop:true,
  stagePadding: 200,
  autoplay:true,
  // navText: ["<i class='fa fa-long-arrow-left'></i>","<i class='fa fa-long-arrow-right'></i>"],
  responsive: {
    0: {
        stagePadding: 0
    },
    1000: {
        stagePadding: 200
    }
}
})

$('#owl-carousel_tab_d').owlCarousel({
  loop: true,
  margin: 20,
  dots: false,
  nav: false,
  items:1,
  loop:true,
  stagePadding: 200,
  autoplay:true,
  // navText: ["<i class='fa fa-long-arrow-left'></i>","<i class='fa fa-long-arrow-right'></i>"],
  responsive: {
    0: {
        stagePadding: 0
    },
    1000: {
        stagePadding: 200
    }
}
})

$('#owl-carousel_tab_e').owlCarousel({
  loop: true,
  margin: 20,
  dots: false,
  nav: false,
  items:1,
  loop:true,
  stagePadding: 200,
  autoplay:true,
  // navText: ["<i class='fa fa-long-arrow-left'></i>","<i class='fa fa-long-arrow-right'></i>"],
  responsive: {
    0: {
        stagePadding: 0
    },
    1000: {
        stagePadding: 200
    }
}
})

$('#owl-carousel_tab_ff').owlCarousel({
  loop: true,
  margin: 20,
  dots: false,
  nav: false,
  items:1,
  loop:true,
  stagePadding: 200,
  autoplay:true,
  // navText: ["<i class='fa fa-long-arrow-left'></i>","<i class='fa fa-long-arrow-right'></i>"],
  responsive: {
    0: {
        stagePadding: 0
    },
    1000: {
        stagePadding: 200
    }
}
})

$('#owl-carousel_tab_hh').owlCarousel({
  loop: true,
  margin: 20,
  dots: false,
  nav: false,
  items:1,
  loop:true,
  stagePadding: 200,
  autoplay:true,
  // navText: ["<i class='fa fa-long-arrow-left'></i>","<i class='fa fa-long-arrow-right'></i>"],
  responsive: {
    0: {
        stagePadding: 0
    },
    1000: {
        stagePadding: 200
    }
}
})

$('#owl-carousel_tab_6').owlCarousel({
  loop: true,
  margin: 20,
  dots: false,
  nav: false,
  items:1,
  loop:true,
  stagePadding: 200,
  autoplay:true,
  // navText: ["<i class='fa fa-long-arrow-left'></i>","<i class='fa fa-long-arrow-right'></i>"],
  responsive: {
    0: {
        stagePadding: 0
    },
    1000: {
        stagePadding: 200
    }
}
})

$('#owl-carousel_unique').owlCarousel({
  loop: true,
  margin: 30,
  dots: true,
  nav: false,
  items: 6,
})

$('#owl-carousel_outdoor').owlCarousel({
  loop: false,
    margin: 30,
    dots: false,
    nav: true,
    items: 6,
    navText: ["<i class='fa fa-angle-left'></i>","<i class='fa fa-angle-right'></i>"],
    autoplay:true,
   
    loop: true,
  responsive:{
          0:{
              items:2,
             
          },
          767:{
              items:3,
             
          },
          991:{
              items:3,
              
          },
      
          992:{
              items:3,
              
          },
      
          1200:{
              items:4,
              
          },
          
          1366:{
              items:6,
             
          },
          1920:{
              items:6,
              
          }
        }
})


$(document).ready(function() {

  // required elements
  var imgPopup = $('.img-popup');
  var imgCont  = $('.container__img-holder');
  var popupImage = $('.img-popup img');
  var closeBtn = $('.close-btn');

  // handle events
  imgCont.on('click', function() {
    var img_src = $(this).children('img').attr('src');
    imgPopup.children('img').attr('src', img_src);
    imgPopup.addClass('opened');
  });

  $(imgPopup, closeBtn).on('click', function() {
    imgPopup.removeClass('opened');
    imgPopup.children('img').attr('src', '');
  });

  popupImage.on('click', function(e) {
    e.stopPropagation();
  });
  
});


$(document).ready(function() {

  // required elements
  var imgPopup = $('.img-popup2');
  var imgCont  = $('.container__img-holder2');
  var popupImage = $('.img-popup2 img');
  var closeBtn = $('.close-btn2');

  // handle events
  imgCont.on('click', function() {
    var img_src = $(this).children('img').attr('src');
    imgPopup.children('img').attr('src', img_src);
    imgPopup.addClass('opened');
  });

  $(imgPopup, closeBtn).on('click', function() {
    imgPopup.removeClass('opened');
    imgPopup.children('img').attr('src', '');
  });

  popupImage.on('click', function(e) {
    e.stopPropagation();
  });
  
});




