antimatter.js 802 B

12345678910111213141516171819202122232425262728293031323334353637
  1. var isTouch = window.DocumentTouch && document instanceof DocumentTouch;
  2. function scrollHeader() {
  3. // Has scrolled class on header
  4. var zvalue = $(document).scrollTop();
  5. if ( zvalue > 75 )
  6. $("#header").addClass("scrolled");
  7. else
  8. $("#header").removeClass("scrolled");
  9. }
  10. jQuery(document).ready(function($){
  11. // ON SCROLL EVENTS
  12. if (!isTouch){
  13. $(document).scroll(function() {
  14. scrollHeader();
  15. });
  16. };
  17. // TOUCH SCROLL
  18. $(document).on({
  19. 'touchmove': function(e) {
  20. scrollHeader(); // Replace this with your code.
  21. }
  22. });
  23. //Smooth scroll to top
  24. $('#toTop').click(function(){
  25. $("html, body").animate({ scrollTop: 0 }, 500);
  26. return false;
  27. });
  28. // Responsive Menu
  29. });