main.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. Projection by TEMPLATED
  3. templated.co @templatedco
  4. Released for free under the Creative Commons Attribution 3.0 license (templated.co/license)
  5. */
  6. (function($) {
  7. // Breakpoints.
  8. skel.breakpoints({
  9. xlarge: '(max-width: 1680px)',
  10. large: '(max-width: 1280px)',
  11. medium: '(max-width: 980px)',
  12. small: '(max-width: 736px)',
  13. xsmall: '(max-width: 480px)'
  14. });
  15. $(function() {
  16. var $window = $(window),
  17. $body = $('body');
  18. // Disable animations/transitions until the page has loaded.
  19. $body.addClass('is-loading');
  20. $window.on('load', function() {
  21. window.setTimeout(function() {
  22. $body.removeClass('is-loading');
  23. }, 100);
  24. });
  25. // Prioritize "important" elements on medium.
  26. skel.on('+medium -medium', function() {
  27. $.prioritize(
  28. '.important\\28 medium\\29',
  29. skel.breakpoint('medium').active
  30. );
  31. });
  32. // Off-Canvas Navigation.
  33. // Navigation Panel.
  34. $(
  35. '<div id="navPanel">' +
  36. $('#nav').html() +
  37. '<a href="#navPanel" class="close"></a>' +
  38. '</div>'
  39. )
  40. .appendTo($body)
  41. .panel({
  42. delay: 500,
  43. hideOnClick: true,
  44. hideOnSwipe: true,
  45. resetScroll: true,
  46. resetForms: true,
  47. side: 'left'
  48. });
  49. // Fix: Remove transitions on WP<10 (poor/buggy performance).
  50. if (skel.vars.os == 'wp' && skel.vars.osVersion < 10)
  51. $('#navPanel')
  52. .css('transition', 'none');
  53. });
  54. })(jQuery);