desk.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. jQuery(document).ready(function($) {
  2. // (loader fade-out is handled by loader.php's own script — slow fade, matching Studio)
  3. $(function() {
  4. $("img.alignnone").lazyload();
  5. });
  6. /*============================================
  7. Navigation
  8. ==============================================*/
  9. $('.nav-toggle').on('touchstart click', function(e) {
  10. e.preventDefault();
  11. $( this ).toggleClass( 'active' );
  12. });
  13. $(function dw_hidenav() {
  14. var headerHeight = $('.navbar').height();
  15. $(window).on('scroll', { previousTop: 0 },
  16. function() {
  17. var currentTop = $(window).scrollTop();
  18. if (currentTop < this.previousTop) {
  19. if (currentTop > 0 && $('.navbar').hasClass('fixed')) {
  20. $('.navbar').addClass('visible');
  21. $('.site-title a').removeClass('light');
  22. } else {
  23. $('.navbar').removeClass('visible fixed');
  24. }
  25. }
  26. else {
  27. $('.navbar').removeClass('visible');
  28. if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed');
  29. }
  30. this.previousTop = currentTop;
  31. }
  32. );
  33. });
  34. });