app.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. author: Boostraptheme
  3. author URL: https://boostraptheme.com
  4. License: Creative Commons Attribution 4.0 Unported
  5. License URL: https://creativecommons.org/licenses/by/4.0/
  6. */
  7. /* ====================================================
  8. ANIMATION
  9. ================================================= */
  10. $(function () {
  11. // animate on scroll
  12. new WOW().init();
  13. });
  14. /* ====================================================
  15. NAVIGATION
  16. ================================================= */
  17. (function($) {
  18. "use strict"; // Start of use strict
  19. // Smooth scrolling using jQuery easing
  20. $('a.js-scroll-trigger[href*="#"]:not([href="#"])').click(function() {
  21. if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
  22. var target = $(this.hash);
  23. target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
  24. if (target.length) {
  25. $('html, body').animate({
  26. scrollTop: (target.offset().top - 63)
  27. }, 1000, "easeInOutExpo");
  28. return false;
  29. }
  30. }
  31. });
  32. // Closes responsive menu when a scroll trigger link is clicked
  33. $('.js-scroll-trigger').click(function() {
  34. $('.navbar-collapse').collapse('hide');
  35. });
  36. // Activate scrollspy to add active class to navbar items on scroll
  37. $('body').scrollspy({
  38. target: '#mainNav',
  39. offset: 64
  40. });
  41. // Collapse Navbar
  42. var navbarCollapse = function() {
  43. if ($("#mainNav").offset().top > 100) {
  44. $("#mainNav").addClass("navbar-shrink");
  45. } else {
  46. $("#mainNav").removeClass("navbar-shrink");
  47. }
  48. };
  49. // Collapse now if page is not at top
  50. navbarCollapse();
  51. // Collapse the navbar when page is scrolled
  52. $(window).scroll(navbarCollapse);
  53. // Hide navbar when modals trigger
  54. $('.portfolio-modal').on('show.bs.modal', function(e) {
  55. $(".navbar").addClass("d-none");
  56. })
  57. $('.portfolio-modal').on('hidden.bs.modal', function(e) {
  58. $(".navbar").removeClass("d-none");
  59. })
  60. })(jQuery); // End of use strict
  61. /*====================================================
  62. GALlERY
  63. ====================================================*/
  64. $(function() {
  65. $("#gallery-slider").owlCarousel({
  66. items: 3,
  67. smartSpeed: 700,
  68. autoplay: true,
  69. loop: true,
  70. pagination: true,
  71. slideSpeed: 1000,
  72. responsive: {
  73. 0: {
  74. items: 1
  75. },
  76. 500: {
  77. items: 2
  78. },
  79. 767: {
  80. items: 2
  81. },
  82. 992: {
  83. items: 3
  84. }
  85. }
  86. });
  87. });
  88. /* ====================================================
  89. BACK TO TOP
  90. =======================================================*/
  91. (function() {
  92. $(window).scroll(function() {
  93. if ($(this).scrollTop() < 50) {
  94. // hide nav
  95. $("nav").removeClass("ss-top-nav");
  96. $("#back-to-top").fadeOut();
  97. } else {
  98. // show nav
  99. $("nav").addClass("ss-top-nav");
  100. $("#back-to-top").fadeIn();
  101. }
  102. });
  103. }); // End of use strict