You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

scripts.js 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*!
  2. * Start Bootstrap - Freelancer v6.0.3 (https://startbootstrap.com/themes/freelancer)
  3. * Copyright 2013-2020 Start Bootstrap
  4. * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap-freelancer/blob/master/LICENSE)
  5. */
  6. (function($) {
  7. "use strict"; // Start of use strict
  8. // Smooth scrolling using jQuery easing
  9. $('a.js-scroll-trigger[href*="#"]:not([href="#"])').click(function() {
  10. if (
  11. location.pathname.replace(/^\//, "") ==
  12. this.pathname.replace(/^\//, "") &&
  13. location.hostname == this.hostname
  14. ) {
  15. var target = $(this.hash);
  16. target = target.length ? target : $("[name=" + this.hash.slice(1) + "]");
  17. if (target.length) {
  18. $("html, body").animate(
  19. {
  20. scrollTop: target.offset().top - 71
  21. },
  22. 1000,
  23. "easeInOutExpo"
  24. );
  25. return false;
  26. }
  27. }
  28. });
  29. // Scroll to top button appear
  30. $(document).scroll(function() {
  31. var scrollDistance = $(this).scrollTop();
  32. if (scrollDistance > 100) {
  33. $(".scroll-to-top").fadeIn();
  34. } else {
  35. $(".scroll-to-top").fadeOut();
  36. }
  37. });
  38. // Closes responsive menu when a scroll trigger link is clicked
  39. $(".js-scroll-trigger").click(function() {
  40. $(".navbar-collapse").collapse("hide");
  41. });
  42. // Activate scrollspy to add active class to navbar items on scroll
  43. $("body").scrollspy({
  44. target: "#mainNav",
  45. offset: 80
  46. });
  47. // Collapse Navbar
  48. var navbarCollapse = function() {
  49. if ($("#mainNav").offset().top > 100) {
  50. $("#mainNav").addClass("navbar-shrink");
  51. } else {
  52. $("#mainNav").removeClass("navbar-shrink");
  53. }
  54. };
  55. // Collapse now if page is not at top
  56. navbarCollapse();
  57. // Collapse the navbar when page is scrolled
  58. $(window).scroll(navbarCollapse);
  59. // Floating label headings for the contact form
  60. $(function() {
  61. $("body")
  62. .on("input propertychange", ".floating-label-form-group", function(e) {
  63. $(this).toggleClass(
  64. "floating-label-form-group-with-value",
  65. !!$(e.target).val()
  66. );
  67. })
  68. .on("focus", ".floating-label-form-group", function() {
  69. $(this).addClass("floating-label-form-group-with-focus");
  70. })
  71. .on("blur", ".floating-label-form-group", function() {
  72. $(this).removeClass("floating-label-form-group-with-focus");
  73. });
  74. });
  75. })(jQuery); // End of use strict