main.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. Spatial 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. skel.breakpoints({
  8. xlarge: '(max-width: 1680px)',
  9. large: '(max-width: 1280px)',
  10. medium: '(max-width: 980px)',
  11. small: '(max-width: 736px)',
  12. xsmall: '(max-width: 480px)'
  13. });
  14. $(function() {
  15. var $window = $(window),
  16. $body = $('body');
  17. // Disable animations/transitions until the page has loaded.
  18. $body.addClass('is-loading');
  19. $window.on('load', function() {
  20. window.setTimeout(function() {
  21. $body.removeClass('is-loading');
  22. }, 100);
  23. });
  24. // Fix: Placeholder polyfill.
  25. $('form').placeholder();
  26. // Prioritize "important" elements on medium.
  27. skel.on('+medium -medium', function() {
  28. $.prioritize(
  29. '.important\\28 medium\\29',
  30. skel.breakpoint('medium').active
  31. );
  32. });
  33. // Off-Canvas Navigation.
  34. // Navigation Panel Toggle.
  35. $('<a href="#navPanel" class="navPanelToggle"></a>')
  36. .appendTo($body);
  37. // Navigation Panel.
  38. $(
  39. '<div id="navPanel">' +
  40. $('#nav').html() +
  41. '<a href="#navPanel" class="close"></a>' +
  42. '</div>'
  43. )
  44. .appendTo($body)
  45. .panel({
  46. delay: 500,
  47. hideOnClick: true,
  48. hideOnSwipe: true,
  49. resetScroll: true,
  50. resetForms: true,
  51. side: 'right'
  52. });
  53. // Fix: Remove transitions on WP<10 (poor/buggy performance).
  54. if (skel.vars.os == 'wp' && skel.vars.osVersion < 10)
  55. $('#navPanel')
  56. .css('transition', 'none');
  57. });
  58. })(jQuery);