Advertisement
Guest User

Untitled

a guest
May 19th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. // -------------------------------------------------------
  2. // Плавный скрол к якорю v2 START
  3. // -------------------------------------------------------
  4.  
  5. jQuery(document).ready(function() {
  6. jQuery(window).bind("load", function() {
  7. //Пример исключения ссылки:
  8. //jQuery('a[href*="#"]:not([href="#"],[href="#spu-209"],[href="#spu-211"],[href="#spu-212"],[href="#spu-213"],[href="#spu-214"],[href="#spu-215"],[href="#spu-217"])').click(function() {
  9. jQuery('a[href*="#"]:not(.spu-clickable,.woocommerce, button#place_order, li.menu-item ul.sub-menu, [href="#"], .zita-menu.collapse span.arrow)').one("click", function(e){
  10. // .click(function() {
  11. if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') ||
  12. location.hostname == this.hostname) {
  13. var target = jQuery(this.hash);
  14. target = target.length ? target : jQuery('[name=' + this.hash.slice(1) + ']');
  15. if (target.length) {
  16. jQuery("html, body").animate({
  17. // $('html, body').animate({
  18. scrollTop: target.offset().top - 0
  19. }, 1000);
  20. return false;
  21. }
  22. }
  23. });
  24. });
  25. });
  26. jQuery(window).load(function() {
  27. function goToByScroll(id) {
  28. jQuery("html, body").animate({
  29. scrollTop: jQuery("#" + id).offset().top - 0
  30. }, 1000);
  31. }
  32. if (window.location.hash != '') {
  33. goToByScroll(window.location.hash.substr(1));
  34. }
  35. });
  36. // -------------------------------------------------------
  37. // Плавный скрол к якорю v2 END
  38. // -------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement