You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.4 KiB
60 lines
1.4 KiB
7 years ago
|
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");
|
||
|
}
|
||
|
|
||
|
function parallaxBackground() {
|
||
|
$('.parallax').css('background-positionY', ($(window).scrollTop() * 0.3) + 'px');
|
||
|
}
|
||
|
|
||
|
jQuery(document).ready(function($){
|
||
|
|
||
|
scrollHeader();
|
||
|
|
||
|
// Scroll Events
|
||
|
if (!isTouch){
|
||
|
$(document).scroll(function() {
|
||
|
scrollHeader();
|
||
|
parallaxBackground();
|
||
|
});
|
||
|
};
|
||
|
|
||
|
// 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});
|
||
|
|
||
|
});
|