Use the following simple example
function scrollToElement(ele) {
$(window).scrollTop(ele.offset().top).scrollLeft(ele.offset().left);
}
where ele
is your element (jQuery) .. for example : scrollToElement($('#myid'));
More Related Contents:
- CSS or jQuery : How to get visible top [duplicate]
- Write tags in HTML and print
- Get this error: “Uncaught TypeError: Cannot read property ‘0’ of undefined”
- How can I determine the direction of a jQuery scroll event?
- Dynamically load JS inside JS [duplicate]
- Get class list for element with jQuery
- Allow Google Chrome to use XMLHttpRequest to load a URL from a local file
- AngularJS – Any way for $http.post to send request parameters instead of JSON?
- What is the cleanest way to get the progress of JQuery ajax request?
- How to detect window.print() finish
- What is difference between width, innerWidth and outerWidth, height, innerHeight and outerHeight in jQuery
- How to force reloading a page when using browser back button?
- (Deep) copying an array using jQuery [duplicate]
- Does .css() automatically add vendor prefixes?
- how to convert this nested object into a flat object?
- Best way to detect Mac OS X or Windows computers with JavaScript or jQuery
- Synchronized scrolling using jQuery?
- jQuery: $().click(fn) vs. $().bind(‘click’,fn);
- How to check whether multiple values exist within an Javascript array
- Calling webpage JavaScript methods from browser extension
- Multiple Select limit number of selection
- With jQuery, how do I capitalize the first letter of a text field while the user is still editing that field?
- jQuery() not finding elements in jQuery.parseHTML() result
- window.open popup getting blocked during click event
- How do I detect the inherited background-color of an element using jQuery/JS?
- Updating a JSON object using Javascript
- Synchronous XMLHttpRequest on the main thread is deprecated
- jQuery: noConflict
- ASP.NET MVC Partial view ajax post?
- Is there any size limitation for ajax post?