Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. $('a[href*="#"]')
  2. // Remove links that don't actually link to anything
  3. .not('[href="#"]')
  4. .not('[href="#0"]')
  5. .click(function(event) {
  6. // On-page links
  7. if (
  8. location.pathname.replace(/^//, "") ==
  9. this.pathname.replace(/^//, "") &&
  10. location.hostname == this.hostname
  11. ) {
  12. // Figure out element to scroll to
  13. var target = $(this.hash);
  14. target = target.length
  15. ? target
  16. : $("[name=" + this.hash.slice(1) + "]");
  17. // Does a scroll target exist?
  18. if (target.length) {
  19. // Only prevent default if animation is actually gonna happen
  20. event.preventDefault();
  21. $("html, body").animate(
  22. {
  23. scrollTop: target.offset().top - 91
  24. },
  25. 1000,
  26. function() {
  27. // Callback after animation
  28. // Must change focus!
  29. var $target = $(target);
  30. $target.focus();
  31. if ($target.is(":focus")) {
  32. // Checking if the target was focused
  33. return false;
  34. } else {
  35. $target.attr("tabindex", "-1"); // Adding tabindex for elements not focusable
  36. $target.focus(); // Set focus again
  37. }
  38. }
  39. );
  40. }
  41. }
  42. });
  43.  
  44. <div class="service-menu-area">
  45. <ul class="nav">
  46. <li>
  47. <a class="active" data-toggle="tab" href="#spa">
  48. <span class="service-icon">
  49. <img src="img/icon/service-icon1.png" alt="">
  50. </span>
  51. <span class="service-title">Room Service</span>
  52. <span class="text">
  53. <span>Room Service</span>
  54. luptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia
  55. </span>
  56. </a>
  57. </li>
  58. </ul>
  59. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement