Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6172425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:23:25+00:00 2026-05-23T23:23:25+00:00

Scrolling to anchors (using jquery) is common – however after the scroll, the user

  • 0

Scrolling to anchors (using jquery) is common – however after the scroll, the user is still able to scroll the entire page with the native scroll bar.

This is what’s needed in nearly every circumstance, however I’d like the user to click a link, get scrolled to the link – the html/body resize (to the divs) size and then the user can just scroll that area, like they’re on a separate page. I’ve accomplished this in FireFox, however in every other browser the code malfunctions. It seems i have something out of order/missing, as broswers like Chrome scrolling is fine, getting div height is fine but when the jquery resizes the html/body, chrome jumps right back up to the top of the page. How could i get around this?

Basically it’s function in FF 5.0 is perfect and i’d like to replicate it across most browsers.

html {
    overflow: auto;
}

body {
  overflow: hidden;
}

.

function goToByScroll(id){
            $('html,body').css('height', '100%');
            $('html,body').css('overflow', 'auto');
            $('html,body').animate({scrollTop: $("#"+id).offset().top},'slow', function(){
                $('html').css('overflow','auto');
                $('body').css('overflow','hidden');
                $('html,body').css('height', ($("."+id).css('height')));

            });

    }

j

<div class="links">
                <ul class="navigation">
                    <li><a href="javascript:void(0)" onClick="goToByScroll('linkOne')">linkOne</a>
                    </li><li>
                    <a href="javascript:void(0)" onClick="goToByScroll('linkTwo')">linkTwo</a>
                    </li><li>
                    <a href="javascript:void(0)" onClick="goToByScroll('linkThree')">linkThree</a>
                    </li><li>
                    <a href="javascript:void(0)" onClick="goToByScroll('linkFour')">linkFour</a></li>
                </ul>
            </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:23:26+00:00Added an answer on May 23, 2026 at 11:23 pm

    Here’s one way to do this by setting the content <div>s to overflow:auto and <body> to overflow:hidden then adjust the body’s top offset

    example: http://jsfiddle.net/pxfunc/BKvae/2/

    // declare re-usable jQuery objects and a scrollTo value
    var $body = $('body'),
        $content = $('#content > div'),
        scrollTo = 0;
    
    // adjust the content height on window resize
    $(window).resize(function() {
        resizeContent();
    });
    
    var resizeContent = function() {
        $content.height($(window).height());
    }; 
    
    // initial setter for content area height to match window
    resizeContent();
    
    // handle link clicks via jQuery
    $('.navigation a').click(function(e) {
        e.preventDefault()
        var $that = $(this); 
        var $contentArea = $($that.attr('href')); // get the div
    
        if ($contentArea.position().top !== 0) { // check if already on that contentArea
            scrollTo = ($body.css('top').replace(/\D+/g, '') * 1) + $contentArea.position().top; // calculate where the body offset should end up
            $body.animate({top: -scrollTo}, 'slow');
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking to implement horizontal scrolling using jQuery.SerialScroll (based on jQuery.ScrollTo ). I
tl;dr I have an HTML+CSS page layout using positioned and scrolling boxes to simulate
I am building a scrolling website using JQuery localscroll, building on a few demo's
I am designing a website using the jQuery Tools library for things like scrolling
When scrolling down on a DataGrid page using the keyboard, the last visible item
I'm using JQuery UI to add a calendar in my web page and I
I have a scrolling LED sign that takes messages in either ASCII or (using
UITableViewCells scrolling speed increases dramatically when you do custom drawing, however, Accessibility breaks. How
While scrolling my web page a DIV which have a video is not going
I am attempting to scroll the window to a location on my page based

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.