scrollTop() returns 0 in Firefox, but not in Chrome

前端 未结 4 524
天涯浪人
天涯浪人 2020-12-15 16:17

Not sure if there\'s another question regarding this, if so I apologize and please don\'t release the hounds.

Using the html5 doctype and doing a quick console.log o

4条回答
  •  余生分开走
    2020-12-15 16:40

    Use var scrollTop = $('html').scrollTop(); works for FireFox

    You'll need to sniff the browser out though (I know, feature detect, not sniff, but you can't detect this), because it won't work in Chrome, try here :

    Easiest/Lightest Replacement For Browser Detection jQuery 1.9?

提交回复
热议问题