Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('a[href*="#"]')
- // Remove links that don't actually link to anything
- .not('[href="#"]')
- .not('[href="#0"]')
- .click(function(event) {
- // On-page links
- if (
- location.pathname.replace(/^//, "") ==
- this.pathname.replace(/^//, "") &&
- location.hostname == this.hostname
- ) {
- // Figure out element to scroll to
- var target = $(this.hash);
- target = target.length
- ? target
- : $("[name=" + this.hash.slice(1) + "]");
- // Does a scroll target exist?
- if (target.length) {
- // Only prevent default if animation is actually gonna happen
- event.preventDefault();
- $("html, body").animate(
- {
- scrollTop: target.offset().top - 91
- },
- 1000,
- function() {
- // Callback after animation
- // Must change focus!
- var $target = $(target);
- $target.focus();
- if ($target.is(":focus")) {
- // Checking if the target was focused
- return false;
- } else {
- $target.attr("tabindex", "-1"); // Adding tabindex for elements not focusable
- $target.focus(); // Set focus again
- }
- }
- );
- }
- }
- });
- <div class="service-menu-area">
- <ul class="nav">
- <li>
- <a class="active" data-toggle="tab" href="#spa">
- <span class="service-icon">
- <img src="img/icon/service-icon1.png" alt="">
- </span>
- <span class="service-title">Room Service</span>
- <span class="text">
- <span>Room Service</span>
- luptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia
- </span>
- </a>
- </li>
- </ul>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement