You need to animate the html, body
DEMO http://jsfiddle.net/kevinPHPkevin/8tLdq/1/
$("#button").click(function() {
$('html, body').animate({
scrollTop: $("#myDiv").offset().top
}, 2000);
});
More Related Contents:
- Scroll Function working in reverse order [closed]
- How to check if element is visible after scrolling?
- How to disable scrolling temporarily?
- Check if a user has scrolled to the bottom (not just the window, but any element) [duplicate]
- Scroll Automatically to the Bottom of the Page
- How to scroll an HTML page to a given anchor
- How can I make a div stick to the top of the screen once it’s been scrolled to?
- jQuery load more data on scroll
- Event when user stops scrolling
- Prevent BODY from scrolling when a modal is opened
- Scroll to an element with jQuery
- jQuery scroll() detect when user stops scrolling
- Trigger event when user scroll to specific element – with jQuery
- How to scroll to specific item using jQuery?
- prevent Scroll bubbling from element to window
- Make scrollbar visible in mobile browsers
- How to scroll the window using JQuery $.scrollTo() function
- Fade In on Scroll Down, Fade Out on Scroll Up – based on element position in window
- Stop fixed position at footer
- javascript: detect scroll end
- How can I differentiate a manual scroll (via mousewheel/scrollbar) from a Javascript/jQuery scroll?
- jQuery jump or scroll to certain position, div or target on the page from button onclick [duplicate]
- Detect if a page has a vertical scrollbar?
- Reverse Scrolling
- prevent touchstart when swiping
- jQuery load content when scroll to bottom-100px of page, multiple events fired
- Disabling middle click scrolling with javascript
- jQuery – bind event on Scroll Stop
- Load ajax when scroll reaches 80%
- Automatically scroll down chat div