/*-----------------------------------------------------------------------------------
Template Name: Gowilds - Tours and Travel HTML Template
Template URI: site.com
Description: Gowilds is a modern Adventure Tours and Travel HTML Template designed for all activities, sports, hiking, or outdoor adventures.
Author: WebTend
Author URI: https://webtend.net/
Version: 1.0
Note: This is Main Js file
-----------------------------------------------------------------------------------
Js INDEX
===================
## Main Menu
## Document Ready
## Nav Overlay
## Preloader
## Sticky
## Back to top
## Counter
## Magnific-popup js
## Nice select
## Slick Slider
## WOW Js
## Price Quantity
## Price Ranger js
## Date Picker
## Calendar JS
-----------------------------------------------------------------------------------*/
(function($) {
'use strict';
//===== Main Menu
function mainMenu() {
// Variables
var var_window = $(window),
navContainer = $('.header-navigation'),
navbarToggler = $('.navbar-toggler'),
navMenu = $('.nav-menu'),
navMenuLi = $('.nav-menu ul li ul li'),
closeIcon = $('.navbar-close');
// navbar toggler
navbarToggler.on('click', function() {
navbarToggler.toggleClass('active');
navMenu.toggleClass('menu-on');
});
// close icon
closeIcon.on('click', function() {
navMenu.removeClass('menu-on');
navbarToggler.removeClass('active');
});
// adds toggle button to li items that have children
navMenu.find("li a").each(function() {
if ($(this).children('.dd-trigger').length < 1) {
if ($(this).next().length > 0) {
$(this).append('')
}
}
});
// expands the dropdown menu on each click
navMenu.find(".dd-trigger").on('click', function(e) {
e.preventDefault();
$(this).parent().parent().siblings().children('ul.sub-menu').slideUp();
$(this).parent().next('ul.sub-menu').stop(!0, !0).slideToggle(350);
$(this).toggleClass('sub-menu-open')
});
// check browser width in real-time
function breakpointCheck() {
var windowWidth = window.innerWidth;
if (windowWidth <= 1199) {
navContainer.addClass('breakpoint-on');
} else {
navContainer.removeClass('breakpoint-on');
}
}
breakpointCheck();
var_window.on('resize', function() {
breakpointCheck();
});
};
// Document Ready
$(document).ready(function() {
mainMenu();
});
// Nav Overlay On
$(".navbar-toggler, .navbar-close,.nav-overlay").on('click', function(e) {
$(".nav-overlay").toggleClass("active");
});
$(".nav-overlay").on('click', function(e) {
$(".navbar-toggler").removeClass("active");
$(".nav-menu").removeClass("menu-on");
});
//===== Preloader
$(window).on('load', function(event) {
$('.preloader').delay(500).fadeOut('500');
})
//===== Sticky
$(window).on('scroll', function(event) {
var scroll = $(window).scrollTop();
if (scroll < 100) {
$(".header-navigation").removeClass("sticky");
} else {
$(".header-navigation").addClass("sticky");
}
});
//===== Back to top
$(window).on('scroll', function(event) {
if ($(this).scrollTop() > 600) {
$('.back-to-top').fadeIn(200)
} else {
$('.back-to-top').fadeOut(200)
}
});
$('.back-to-top').on('click', function(event) {
event.preventDefault();
$('html, body').animate({
scrollTop: 0,
}, 1500);
});
//===== Counter js
if ($('.count').length) {
$('.count').counterUp({
delay: 100,
time: 4000
});
}
//===== Magnific-popup js
if ($('.video-popup').length) {
$('.video-popup').magnificPopup({
type: 'iframe',
removalDelay: 300,
mainClass: 'mfp-fade'
});
}
if ($('.img-popup').length) {
$(".img-popup").magnificPopup({
type: "image",
gallery: {
enabled: true
}
});
}
//===== Nice select js
if ($('select').length) {
$('select').niceSelect();
}
//===== Slick slider js
$('.hero-slider-one, .hero-slider-two').on('init', function(e, slick) {
var $firstAnimatingElements = $('div.single-slider:first-child').find('[data-animation]');
doAnimations($firstAnimatingElements);
});
$('.hero-slider-one, .hero-slider-two').on('beforeChange', function(e, slick, currentSlide, nextSlide) {
var $animatingElements = $('div.single-slider[data-slick-index="' + nextSlide + '"]').find('[data-animation]');
doAnimations($animatingElements);
});
function doAnimations(elements) {
var animationEndEvents = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
elements.each(function() {
var $this = $(this);
var $animationDelay = $this.data('delay');
var $animationType = 'animated ' + $this.data('animation');
$this.css({
'animation-delay': $animationDelay,
'-webkit-animation-delay': $animationDelay
});
$this.addClass($animationType).one(animationEndEvents, function() {
$this.removeClass($animationType);
});
});
}
if ($('.hero-slider-one').length) {
$('.hero-slider-one').slick({
dots: false,
arrows: true,
infinite: true,
speed: 800,
fade: true,
autoplay: true,
slidesToShow: 1,
slidesToScroll: 1,
prevArrow: '
',
nextArrow: '
',
responsive: [{
breakpoint: 1200,
settings: {
arrows: false
}
}, ]
});
}
if ($('.hero-slider-two').length) {
$('.hero-slider-two').slick({
dots: false,
arrows: true,
infinite: true,
speed: 800,
fade: true,
cssEase: 'cubic-bezier(0.7, 0, 0.3, 1)',
autoplay: true,
slidesToShow: 1,
slidesToScroll: 1,
prevArrow: '
',
nextArrow: '
',
responsive: [{
breakpoint: 1024,
settings: {
arrows: false
}
}]
});
}
if ($('.hero-slider-three').length) {
var sliderArrows = $('.hero-arrows');
$('.hero-slider-three').slick({
dots: false,
arrows: true,
infinite: true,
speed: 800,
fade: true,
appendArrows: sliderArrows,
cssEase: 'cubic-bezier(0.7, 0, 0.3, 1)',
autoplay: true,
slidesToShow: 1,
slidesToScroll: 1,
prevArrow: '
',
nextArrow: '
',
responsive: [{
breakpoint: 991,
settings: {
arrows: false
}
}]
});
}
if ($('.slider-active-3-item').length) {
$('.slider-active-3-item').slick({
dots: false,
arrows: false,
infinite: true,
speed: 800,
autoplay: true,
slidesToShow: 3,
slidesToScroll: 1,
prevArrow: '
',
nextArrow: '
',
responsive: [{
breakpoint: 1200,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 991,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 800,
settings: {
slidesToShow: 1
}
}
]
});
}
if ($('.slider-active-3-item-dot').length) {
$('.slider-active-3-item-dot').slick({
dots: true,
arrows: false,
infinite: true,
speed: 800,
autoplay: true,
slidesToShow: 3,
slidesToScroll: 1,
prevArrow: '
',
nextArrow: '
',
responsive: [{
breakpoint: 1200,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 991,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 800,
settings: {
slidesToShow: 1
}
}
]
});
}
if ($('.slider-active-4-item').length) {
$('.slider-active-4-item').slick({
dots: false,
arrows: false,
infinite: true,
speed: 800,
autoplay: true,
slidesToShow: 4,
slidesToScroll: 1,
prevArrow: '
',
nextArrow: '
',
responsive: [{
breakpoint: 1400,
settings: {
slidesToShow: 3
}
},
{
breakpoint: 1200,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 575,
settings: {
slidesToShow: 1
}
}
]
});
}
if ($('.slider-active-5-item').length) {
$('.slider-active-5-item').slick({
dots: false,
arrows: false,
infinite: true,
speed: 800,
autoplay: true,
slidesToShow: 5,
slidesToScroll: 1,
prevArrow: '
',
nextArrow: '
',
responsive: [{
breakpoint: 1400,
settings: {
slidesToShow: 4
}
},
{
breakpoint: 1199,
settings: {
slidesToShow: 3
}
},
{
breakpoint: 991,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 575,
settings: {
slidesToShow: 1
}
}
]
});
}
if ($('.place-slider').length) {
$('.place-slider').slick({
dots: false,
arrows: false,
infinite: true,
speed: 800,
autoplay: true,
variableWidth: true,
slidesToShow: 3,
slidesToScroll: 1,
prevArrow: '
',
nextArrow: '
',
responsive: [{
breakpoint: 767,
settings: {
slidesToShow: 1
}
}]
});
}
if ($('.recent-place-slider').length) {
var sliderArrows = $('.place-arrows');
$('.recent-place-slider').slick({
dots: false,
arrows: true,
infinite: true,
speed: 800,
autoplay: true,
appendArrows: sliderArrows,
slidesToShow: 2,
slidesToScroll: 1,
prevArrow: '
',
nextArrow: '
',
responsive: [{
breakpoint: 767,
settings: {
slidesToShow: 1
}
}]
});
}
if ($('.testimonial-slider-one').length) {
$('.testimonial-slider-one').slick({
dots: false,
arrows: false,
infinite: true,
speed: 800,
autoplay: true,
slidesToShow: 1,
slidesToScroll: 1,
prevArrow: '
',
nextArrow: '
'
});
}
if ($('.product-big-slider').length) {
$('.product-big-slider').slick({
dots: false,
arrows: false,
speed: 800,
autoplay: true,
fade: true,
asNavFor: '.product-thumb-slider',
slidesToShow: 1,
slidesToScroll: 1,
prevArrow: '
',
nextArrow: '
'
});
}
if ($('.product-thumb-slider').length) {
$('.product-thumb-slider').slick({
dots: false,
arrows: false,
speed: 800,
autoplay: true,
asNavFor: '.product-big-slider',
focusOnSelect: true,
slidesToShow: 3,
slidesToScroll: 1,
prevArrow: '
',
nextArrow: '
'
});
}
if ($('.partner-slider-one').length) {
$('.partner-slider-one').slick({
dots: false,
arrows: false,
infinite: true,
speed: 800,
autoplay: true,
slidesToShow: 5,
slidesToScroll: 1,
prevArrow: '
',
nextArrow: '
',
responsive: [{
breakpoint: 1400,
settings: {
slidesToShow: 4
}
},
{
breakpoint: 991,
settings: {
slidesToShow: 3
}
},
{
breakpoint: 800,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 575,
settings: {
slidesToShow: 1
}
}
]
});
}
//===== Wow js
new WOW().init();
//======= Price Quantity
$('.quantity-down').on('click', function() {
var numProduct = Number($(this).next().val());
if (numProduct > 1) $(this).next().val(numProduct - 1);
});
$('.quantity-up').on('click', function() {
var numProduct = Number($(this).prev().val());
$(this).prev().val(numProduct + 1);
});
//======= Price ranger
if ($('#slider-range').length) {
$("#slider-range").slider({
range: true,
min: 0,
max: 15000,
values: [5, 10562],
slide: function(event, ui) {
$("#amount").val("$" + ui.values[0] + " - $" + ui.values[1]);
}
});
$("#amount").val("$" + $("#slider-range").slider("values", 0) +
" - $" + $("#slider-range").slider("values", 1));
}
//======= Date Picker
if ($('.datepicker').length) {
$(".datepicker").datepicker();
}
//======= Calendar Js
if ($('.calendar-container').length) {
$('.calendar-container').calendar({
date: new Date(),
showTodayButton: false,
weekDayLength: 2,
prevButton: "",
nextButton: ""
});
}
})(window.jQuery);