How to scroll to top of a div using jQuery?

后端 未结 7 1597
耶瑟儿~
耶瑟儿~ 2020-12-23 17:43

I have a gridview inside a div.. I want to scroll to top of the div from the bottom of the div using jquery.. Any suggestion..

//
7条回答
  •  爱一瞬间的悲伤
    2020-12-23 17:57

    This is my solution to scroll to the top on a button click.

    $(".btn").click(function () {
    if ($(this).text() == "Show options") {
    $(".tabs").animate(
      {
        scrollTop: $(window).scrollTop(0)
      },
      "slow"
     );
     }
    });
    

提交回复
热议问题