27 lines
1.0 KiB
JavaScript
27 lines
1.0 KiB
JavaScript
! function(o) {
|
|
"use strict";
|
|
o(window).on("load", function() {
|
|
o("#preloader").delay(600).fadeOut()
|
|
}), o("body").scrollspy({
|
|
target: "#nav",
|
|
offset: o(window).height() / 2
|
|
}), o("#nav .main-nav a[href^='#']").on("click", function(n) {
|
|
n.preventDefault();
|
|
this.hash;
|
|
o("html, body").animate({
|
|
scrollTop: o(this.hash).offset().top
|
|
}, 600)
|
|
}), o("#back-to-top").on("click", function() {
|
|
o("body,html").animate({
|
|
scrollTop: 0
|
|
}, 600)
|
|
}), o("#nav .nav-collapse").on("click", function() {
|
|
o("#nav").toggleClass("open")
|
|
}), o(".has-dropdown a").on("click", function() {
|
|
o(this).parent().toggleClass("open-drop")
|
|
}), o(window).on("scroll", function() {
|
|
var n = o(this).scrollTop();
|
|
n > 1 ? o("#nav").addClass("fixed-nav") : o("#nav").removeClass("fixed-nav"), n > 700 ? o("#back-to-top").fadeIn() : o("#back-to-top").fadeOut()
|
|
})
|
|
}(jQuery);
|