How do I get the max value of scrollLeft?

前端 未结 8 555
夕颜
夕颜 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:37

    Jquery (>1.9.1): The maximum value scrollLeft can be is:

    $('#elemID').prop("scrollWidth") - $('#elemID').width();
    

提交回复
热议问题