creative.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. (function($) {
  2. "use strict"; // Start of use strict
  3. // Smooth scrolling using jQuery easing
  4. $('a.js-scroll-trigger[href*="#"]:not([href="#"])').click(function() {
  5. if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
  6. var target = $(this.hash);
  7. target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
  8. if (target.length) {
  9. $('html, body').animate({
  10. scrollTop: (target.offset().top - 56)
  11. }, 1000, "easeInOutExpo");
  12. return false;
  13. }
  14. }
  15. });
  16. // Closes responsive menu when a scroll trigger link is clicked
  17. $('.js-scroll-trigger').click(function() {
  18. $('.navbar-collapse').collapse('hide');
  19. });
  20. // Activate scrollspy to add active class to navbar items on scroll
  21. $('body').scrollspy({
  22. target: '#mainNav',
  23. offset: 57
  24. });
  25. // Collapse Navbar
  26. var navbarCollapse = function() {
  27. if ($("#mainNav").offset().top > 100) {
  28. $("#mainNav").addClass("navbar-shrink");
  29. } else {
  30. $("#mainNav").removeClass("navbar-shrink");
  31. }
  32. };
  33. // Collapse now if page is not at top
  34. navbarCollapse();
  35. // Collapse the navbar when page is scrolled
  36. $(window).scroll(navbarCollapse);
  37. // Scroll reveal calls
  38. window.sr = ScrollReveal();
  39. sr.reveal('.sr-icon-1', {
  40. delay: 200,
  41. scale: 0
  42. });
  43. sr.reveal('.sr-icon-2', {
  44. delay: 400,
  45. scale: 0
  46. });
  47. sr.reveal('.sr-icon-3', {
  48. delay: 600,
  49. scale: 0
  50. });
  51. sr.reveal('.sr-icon-4', {
  52. delay: 800,
  53. scale: 0
  54. });
  55. sr.reveal('.sr-button', {
  56. delay: 200,
  57. distance: '15px',
  58. origin: 'bottom',
  59. scale: 0.8
  60. });
  61. sr.reveal('.sr-contact-1', {
  62. delay: 200,
  63. scale: 0
  64. });
  65. sr.reveal('.sr-contact-2', {
  66. delay: 400,
  67. scale: 0
  68. });
  69. // Magnific popup calls
  70. $('.popup-gallery').magnificPopup({
  71. delegate: 'a',
  72. type: 'image',
  73. tLoading: 'Loading image #%curr%...',
  74. mainClass: 'mfp-img-mobile',
  75. gallery: {
  76. enabled: true,
  77. navigateByImgClick: true,
  78. preload: [0, 1]
  79. },
  80. image: {
  81. tError: '<a href="%url%">The image #%curr%</a> could not be loaded.'
  82. }
  83. });
  84. })(jQuery); // End of use strict