Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自己在写javascript 遇到一个问题 大神给我找一下原因 #3

Open
AngryBirdsFighting opened this issue Jan 19, 2017 · 1 comment

Comments

@AngryBirdsFighting
Copy link

声明: 页面引用了jquery. 要获取滚动的距离
1: function qq(){console.log($(window).scrollTop())}
$(window).scroll(qq());
2: $(window).scroll(function (){console.log($(window).scrollTop())};
1 里面获取的距离只显示一次 滚动完 刷新后才能更新,
2 里面的距离一直跟着滚动改变

why!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

@Wensheng98057
Copy link

$(window).scroll(qq());
qq后面的(),让qq直接执行了;
$(window).scroll(qq);这样能生效。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants