How do I get the max value of scrollLeft?

前端 未结 8 610
夕颜
夕颜 2020-12-04 21:28

Okay I\'m using jQuery and currently getting max value of scrollbar doing this:

var $body = $(\'body\');
$body.scrollLeft(99999); // will give me the max val         


        
8条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 21:33

    You can use $(document).width() to get the full width of your document, and $(window).width() to get the width of the window/viewport.

    http://api.jquery.com/width/

提交回复
热议问题