Skip to content

Commit 49b2ed3

Browse files
committed
Merge pull request #12 from obingo/master
fix a cross-browser bug
2 parents 32e436b + eed4933 commit 49b2ed3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/directive.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ var getComputedStyle = document.defaultView.getComputedStyle;
4444

4545
var getScrollEventTarget = function (element) {
4646
var currentNode = element;
47-
while (currentNode && currentNode.tagName !== 'HTML' && currentNode.nodeType === 1) {
47+
// bugfix, see http://w3help.org/zh-cn/causes/SD9013 and http://stackoverflow.com/questions/17016740/onscroll-function-is-not-working-for-chrome
48+
while (currentNode && currentNode.tagName !== 'HTML' && currentNode.tagName !== 'BODY' && currentNode.nodeType === 1) {
4849
var overflowY = getComputedStyle(currentNode).overflowY;
4950
if (overflowY === 'scroll' || overflowY === 'auto') {
5051
return currentNode;

0 commit comments

Comments
 (0)