⚡ Initial commit
This commit is contained in:
31
js/custom.js
Normal file
31
js/custom.js
Normal file
@@ -0,0 +1,31 @@
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
// PRE LOADER
|
||||
$(window).load(function () {
|
||||
$(".preloader").fadeOut(1000); // set duration in brackets
|
||||
});
|
||||
|
||||
// CUSTOM LINK
|
||||
$(".custom-link").click(function () {
|
||||
var el = $(this).attr("href");
|
||||
var elWrapped = $(el);
|
||||
var header_height = $(".navbar").height() + 10;
|
||||
|
||||
scrollToDiv(elWrapped, header_height);
|
||||
return false;
|
||||
|
||||
function scrollToDiv(element, navheight) {
|
||||
var offset = element.offset();
|
||||
var offsetTop = offset.top;
|
||||
var totalScroll = offsetTop - navheight;
|
||||
|
||||
$("body,html").animate(
|
||||
{
|
||||
scrollTop: totalScroll,
|
||||
},
|
||||
300
|
||||
);
|
||||
}
|
||||
});
|
||||
})(window.jQuery);
|
||||
Reference in New Issue
Block a user