Answer the question
In order to leave comments, you need to log in
JS Pixel size on mobile?
Hello! The question is this:
using JQuery, I scroll to a certain element in this way, for example:
var position = $('#element').offset().top;
$('.btn').click(function(){
$('html, body').animate({ scrollTop: position}, 500);
}
Answer the question
In order to leave comments, you need to log in
Try the plugin to scroll - https://github.com/flesler/jquery.scrollTo
And try instead of 'html, body' - document
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question