好的,我正在使用 jQuery,当前正在得到滚动条的最大值:
var $body = $('body');
$body.scrollLeft(99999); // will give me the max value since I've overshot
var max_value = $body.scrollLeft(); // returns 300
$('body').scrollLeft(0);
当我尝试这个: $body[0].scrollWidth
我只是得到内容的实际宽度-1580
I'm thinking there has to be a better way I'm forgetting.
剪辑
To clarify, I also tried $(window).width()
and $(document).width()
which gave me 1280 and 1580, respectively.