var scrollHeight=$(window).scrollTop();
window.onscroll=function(){
console.log(scrollHeight);
}
文档声明是<!DOCTYPE html>
1
booksmith 2015-03-29 13:08:59 +08:00
这是我已前遇到的
一开始我以为是这样的原因 > i think i find the anwser > at win7 chrome33, > $('body').scrollTop() will return correct value, and $('html').scrollTop() will return error value > but at fedora20 chrome33 , $('body').scrollTop() will return 0 , and $('html').scrollTop() will return > > > correct value > > ps: > at win7 chromium 35, chrome 35.0.1853.2 canary > $('body').scrollTop() will return 0 , and $('html').scrollTop() will return correct value 后来再仔细找时,才发现是这个原因。 > It's my problem. my chrome use the features : Enable experimental Web Platform features at chrome://flags/ . And then your plugin doesnt work. when i disable it , everything is becoming ok. > the chromium and canary default is enable this features , so they doesnt work too. 你自己看看是不是这个问题。 |
2
airyland 2015-03-29 14:22:03 +08:00
你进入页面就把值附给一个变量了,还能是其他值么?
window.onscroll=function(){ console.log($(window).scrollTop(); } |
3
airyland 2015-03-29 14:22:46 +08:00
打太快,上面打少了一个括号。
|
5
booksmith 2015-03-29 16:59:56 +08:00
~~!,我看得太大意,没注意楼主的写法...
|