Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

259
Views
Scroll to a div after a few seconds

I am trying to smooth scroll to a div after about a minute on a page. I looked on here and found this answer but it did not help me as the person who gave the answer didn't really answer the person's question.

I'd prefer to use jQuery but I am open to JavaScript as well.

Here is what I have so far:

$(document).ready(function() {
        $('body').delay(5000) 
        .animate({
      'scrollTop': $('#usp').offset().top
        }, 5000); 
    });
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

I hope this helps:

( function($){

setTimeout( function() {
$('html, body').animate({
        scrollTop: $("#elementID").offset().top
        // you can use $(".elementClass") but as ID should be unique, it would be better to use an element ID instead of classes
    }, 2000);
    // 2000 ms is the animation duration

}, 5000) 
// it scrolls to #elementID after 5000 ms = 5 secs

} )(jQuery);

about 4 years ago · Juan Pablo Isaza Report

0

You can use Something like this which is quite easy. Just Create a function with some name and call it after few seconds.

$(document).ready(function() {
    function scrolltodiv(){
            $('html, body').animate({
                scrollTop: $("#myDiv").offset().top
            }, 2000);

    }


    window.setTimeout( scrolltodiv, 5000 );
});
about 4 years ago · Juan Pablo Isaza Report

0

$(function(){
    setTimeout(function(){
      animate("#idorclass" ,2000)
    }, 5000)
})

const animate = (idorclass, animval)=>{
  $('html, body').animate({
    scrollTop: $(idorclass).offset().top
 }, animval);
}

also dynamic function that you can reuse

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!