Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. $(document).ready (function() {
  2.  
  3. /* Za sticky nav */
  4. $(".js--section-usluge").waypoint(function(direction) {
  5.  
  6.  
  7. if(direction=="down") {
  8.  
  9. $("nav").addClass("sticky");
  10.  
  11. } else {
  12. $("nav").removeClass("sticky");
  13.  
  14. }
  15.  
  16.  
  17. });
  18.  
  19. /* Za buttons */
  20.  
  21. $(".js--scroll-to-plans").click(function (){
  22.  
  23. $("html,body").animate({scrollTop: $(".js--section-plans").offset().top}, 1000);
  24.  
  25.  
  26. });
  27.  
  28. $(".js--scroll-to-start").click(function (){
  29.  
  30. $("html,body").animate({scrollTop: $(".js--section-usluge").offset().top}, 1000);
  31.  
  32.  
  33. });
  34.  
  35. /*Navigation scroll*/
  36.  
  37. // Select all links with hashes
  38. $('a[href*="#"]')
  39. // Remove links that don't actually link to anything
  40. .not('[href="#"]')
  41. .not('[href="#0"]')
  42. .click(function(event) {
  43. // On-page links
  44. if (
  45. location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
  46. &&
  47. location.hostname == this.hostname
  48. ) {
  49. // Figure out element to scroll to
  50. var target = $(this.hash);
  51. target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
  52. // Does a scroll target exist?
  53. if (target.length) {
  54. // Only prevent default if animation is actually gonna happen
  55. event.preventDefault();
  56. $('html, body').animate({
  57. scrollTop: target.offset().top
  58. }, 1000, function() {
  59. // Callback after animation
  60. // Must change focus!
  61. var $target = $(target);
  62. $target.focus();
  63. if ($target.is(":focus")) { // Checking if the target was focused
  64. return false;
  65. } else {
  66. $target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
  67. $target.focus(); // Set focus again
  68. };
  69. });
  70. }
  71. }
  72. });
  73.  
  74. /* Mobile nav */
  75.  
  76. $(".js--nav-icon").click(function() {
  77.  
  78. var nav = $(".js--main-nav");
  79. var icon = $(".js--nav-icon i");
  80.  
  81. nav.slideToggle(200);
  82. if (icon.hasClass("ion-md-menu")) {
  83. icon.addClass("ion-md-close");
  84. icon.removeClass("ion-md-menu");
  85.  
  86. } else {
  87.  
  88. icon.addClass("ion-md-menu");
  89. icon.removeClass("ion-md-close");
  90.  
  91.  
  92. }
  93. });
  94.  
  95. /*Cookie consent*/
  96.  
  97. $(document).ready(function(){
  98. setTimeout(function () {
  99. $("#cookieConsent").fadeIn(200);
  100. }, 4000);
  101. $("#closeCookieConsent, .cookieConsentOK").click(function() {
  102. $("#cookieConsent").fadeOut(200);
  103. });
  104. });
  105.  
  106. /*popup*/
  107.  
  108. $(document).ready(function() {
  109. $('.popup').magnificPopup();
  110. });
  111.  
  112. $('.popup').magnificPopup({
  113. type: 'image'
  114. // other options
  115. });
  116.  
  117. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement