Created
May 4, 2020 11:59
-
-
Save Sharifur/6e179e4aeda9af5924d645c8b61452d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function ($) { | |
"use strict"; | |
jQuery(document).ready(function($) { | |
/*---------------------------------- | |
magnific popup activation | |
----------------------------------*/ | |
$('.image-popup').magnificPopup({ | |
type: 'image' | |
}); | |
$('.video-play-btn').magnificPopup({ | |
type: 'video' | |
}); | |
/*------------------------------- | |
back to top | |
------------------------------*/ | |
$(document).on('click', '.back-to-top', function () { | |
$("html,body").animate({ | |
scrollTop: 0 | |
}, 2000); | |
}); | |
/*------------------------------- | |
Navbar Fix | |
------------------------------*/ | |
if($(window).width() < 991){ | |
navbarFix() | |
} | |
}); | |
$(window).on('resize', function () { | |
/*------------------------------- | |
Navbar Fix | |
------------------------------*/ | |
if($(window).width() < 991){ | |
navbarFix() | |
} | |
}); | |
//define variable for store last scrolltop | |
var lastScrollTop = ''; | |
$(window).on('scroll', function () { | |
/*--------------------------- | |
back to top show / hide | |
---------------------------*/ | |
var ScrollTop = $('.back-to-top'); | |
if ($(window).scrollTop() > 1000) { | |
ScrollTop.fadeIn(1000); | |
} else { | |
ScrollTop.fadeOut(1000); | |
} | |
if($(window).width() > 991){ | |
StickyMenu(); | |
} | |
}); | |
$(window).on('load',function(){ | |
/*----------------------------- | |
preloader | |
-----------------------------*/ | |
var preLoder = $("#preloader"); | |
preLoder.fadeOut(1000); | |
/*----------------------------- | |
back to top | |
-----------------------------*/ | |
var backtoTop = $('.back-to-top') | |
backtoTop.fadeOut(100); | |
}); | |
function navbarFix(){ | |
$(document).on('click','.navbar-area .navbar-nav li.menu-item-has-children>a, .navbar-area .navbar-nav li.appside-megamenu>a',function(e){ | |
e.preventDefault(); | |
}) | |
} | |
function StickyMenu() { | |
/*-------------------------- | |
sticky menu activation | |
---------------------------*/ | |
var st = $(this).scrollTop(); | |
var mainMenuTop = $('.navbar-area'); | |
if ($(window).scrollTop() > 1000) { | |
mainMenuTop.addClass('nav-fixed'); | |
} else { | |
mainMenuTop.removeClass('nav-fixed '); | |
} | |
lastScrollTop = st; | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment