Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Scrolling on the top of the page when clicking a tab

$
0
0

Replies: 0

When clicking on a tab the page scrolls to the top.
I changed the # to \\#, as per template dev mentioned in his forum, in parallax function but do not add any other code, as you mentioned, in order not to cause any damage. The closed ticket instructions do not mention where to add the code! So the problem was not solved in my case!

Code section follows

/*parallax scolling*/
    var at_scrollTop_fix = 1;
    top_header_height = 68;
    $('a[href*="\\#"]').click(function(event){
        $('html, body').animate({
            scrollTop: $( $.attr(this, 'href') ).offset().top-$('.at-navbar').height() - top_header_height
        }, 1000);
        event.preventDefault();
    });
    /*bootstrap sroolpy*/
    $("body").scrollspy({target: ".navbar-fixed-top", offset: $('.at-navbar').height()+50 } );

    /*parallax*/
    function mercantile_parallax_fixed(){
        var is_iPad = navigator.userAgent.match(/iPad/i) != null;
        if ( is_iPad ){
            jQuery('.at-parallax,.inner-main-title').each(function() {
                jQuery(this).css('background-attachment','');
            });
        }
        else{
            if ($(window).width() > 767) {
                jQuery('.at-parallax,.inner-main-title').each(function() {
                    jQuery(this).parallax('center', 0.2, true);
                    jQuery(this).css('background-attachment','fixed');
                });
            }
            else{
                jQuery('.at-parallax,.inner-main-title').each(function() {
                    jQuery(this).css('background-attachment','');
                });
            }
        }
    }
    mercantile_parallax_fixed();
    // disable skrollr if the window is resized below 768px wide
    $(window).on('resize', function () {
        mercantile_parallax_fixed();
    });

Viewing all articles
Browse latest Browse all 59525

Trending Articles