File: /home/austral3d/fourdplan.com/files/theme/settings-2.js
// One Page Navigation
$('#desktop-nav').onePageNav({
currentClass: 'current',
changeHash: false,
scrollSpeed: 850,
scrollOffset: 0,
scrollThreshold: 0.5,
filter: ':not(.external)',
easing: 'swing',
begin: function() {
//I get fired when the animation is starting
},
end: function() {
//I get fired when the animation is ending
},
scrollChange: function($currentListItem) {
//I get fired when you enter a section and I pass the list item of the section
}
});
// Smooth scroll
$(document).ready(function() {
$(".scroll-link").click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top + "px"
}, {
duration: 500,
easing: "swing"
});
return false;
});
});
// Parallax
$(document).ready(function(){
//.parallax(xPosition, speedFactor, outerHeight) options:
//xPosition - Horizontal position of the element
//inertia - speed to move relative to vertical scroll. Example: 0.1 is one tenth the speed of scrolling, 2 is twice the speed of scrolling
//outerHeight (true/false) - Whether or not jQuery should use it's outerHeight option to determine when a section is in the viewport
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
var testMobile = isMobile.any();
if (testMobile === null)
{
$('.bg1').parallax("50%", 0.3);
$('.bg2').parallax("50%", 0.3);
$('.bg3').parallax("50%", 0.3);
}
});
// Mobile toggle
$(".nav-button").click(function () {
$(".nav-button,.primary-nav").toggleClass("open");
});