2020-04-22 15:18:29 +02:00
|
|
|
var isTouch = window.DocumentTouch && document instanceof DocumentTouch;
|
|
|
|
|
|
|
|
function scrollHeader() {
|
|
|
|
// Has scrolled class on header
|
|
|
|
var zvalue = $(document).scrollTop();
|
|
|
|
if ( zvalue > 75 )
|
|
|
|
$("#header").addClass("scrolled");
|
|
|
|
else
|
|
|
|
$("#header").removeClass("scrolled");
|
|
|
|
}
|
|
|
|
|
2020-05-06 19:55:37 +02:00
|
|
|
function parallaxBackground(offset) {
|
|
|
|
$('.parallax').css('background-positionY', (parseInt(offset) - ($(window).scrollTop() * 0.1)) + '%');
|
2020-04-22 15:18:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
jQuery(document).ready(function($){
|
|
|
|
|
|
|
|
scrollHeader();
|
|
|
|
|
2020-05-06 19:55:37 +02:00
|
|
|
var heroBasePosition = $('#header-hero').css('background-positionY');
|
|
|
|
|
2020-04-22 15:18:29 +02:00
|
|
|
// Scroll Events
|
|
|
|
if (!isTouch){
|
|
|
|
$(document).scroll(function() {
|
|
|
|
scrollHeader();
|
2020-05-06 19:55:37 +02:00
|
|
|
parallaxBackground(heroBasePosition);
|
2020-04-22 15:18:29 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
// Touch scroll
|
|
|
|
$(document).on({
|
|
|
|
'touchmove': function(e) {
|
|
|
|
scrollHeader(); // Replace this with your code.
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
//Smooth scroll to start
|
|
|
|
$('#to-start').click(function(){
|
|
|
|
var start_y = $('#start').position().top;
|
|
|
|
var header_offset = 45;
|
|
|
|
window.scroll({ top: start_y - header_offset, left: 0, behavior: 'smooth' });
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
//Smooth scroll to top
|
|
|
|
$('#to-top').click(function(){
|
|
|
|
window.scroll({ top: 0, left: 0, behavior: 'smooth' });
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
// Responsive Menu
|
|
|
|
$('#toggle').click(function () {
|
|
|
|
$(this).toggleClass('active');
|
|
|
|
$('#overlay').toggleClass('open');
|
|
|
|
$('body').toggleClass('mobile-nav-open');
|
|
|
|
});
|
|
|
|
|
|
|
|
// Tree Menu
|
|
|
|
$(".tree").treemenu({delay:300});
|
|
|
|
|
|
|
|
});
|