In JQuery is there way for slideDown() method to scroll the page down too?

前端 未结 2 1807
再見小時候
再見小時候 2020-12-14 04:15

The slideDown applied to a div does the slideDown but doesn\'t scroll the page down and the div slided down div remains hidden from view. Is there a way to scroll the page d

2条回答
  •  时光取名叫无心
    2020-12-14 04:59

    Quick demo here

    Basically all you need is

     $('html, body').animate({ 
          scrollTop: $('#yourDiv').offset().top 
      }, 3000); 
    

提交回复
热议问题