Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // -------------------------------------------------------
- // Плавный скрол к якорю v2 START
- // -------------------------------------------------------
- jQuery(document).ready(function() {
- jQuery(window).bind("load", function() {
- //Пример исключения ссылки:
- //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() {
- 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){
- // .click(function() {
- if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') ||
- location.hostname == this.hostname) {
- var target = jQuery(this.hash);
- target = target.length ? target : jQuery('[name=' + this.hash.slice(1) + ']');
- if (target.length) {
- jQuery("html, body").animate({
- // $('html, body').animate({
- scrollTop: target.offset().top - 0
- }, 1000);
- return false;
- }
- }
- });
- });
- });
- jQuery(window).load(function() {
- function goToByScroll(id) {
- jQuery("html, body").animate({
- scrollTop: jQuery("#" + id).offset().top - 0
- }, 1000);
- }
- if (window.location.hash != '') {
- goToByScroll(window.location.hash.substr(1));
- }
- });
- // -------------------------------------------------------
- // Плавный скрол к якорю v2 END
- // -------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement