comunic/developer/user/themes/antimatter/js/antimatter.js
2016-11-19 12:08:12 +01:00

38 lines
802 B
JavaScript

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");
}
jQuery(document).ready(function($){
// ON SCROLL EVENTS
if (!isTouch){
$(document).scroll(function() {
scrollHeader();
});
};
// TOUCH SCROLL
$(document).on({
'touchmove': function(e) {
scrollHeader(); // Replace this with your code.
}
});
//Smooth scroll to top
$('#toTop').click(function(){
$("html, body").animate({ scrollTop: 0 }, 500);
return false;
});
// Responsive Menu
});