Skip to content

Commit

Permalink
Make sure it also works in scrolling parents
Browse files Browse the repository at this point in the history
Until this patch the appear plugin did not fire any events in the following scenario:

<body>
<div>
  ....
  <div style="overflow-y: scroll">
    .....
    <div class="appear-marker"></div>
  </div>
  ....
</div>
</body>
  • Loading branch information
fhackenberger committed Jan 31, 2013
1 parent 721a740 commit 0940aef
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions jquery.appear.js
Expand Up @@ -73,6 +73,11 @@
};

$(window).scroll(on_check).resize(on_check);
this.parents().each(function() {
$this = $(this);
if($this.css('overflow') == 'scroll' || $this.css('overflow-x') == 'scroll' || $this.css('overflow-y') == 'scroll')
$this.scroll(on_check).resize(on_check);
});
check_binded = true;

This comment has been minimized.

Copy link
@morr

morr Feb 6, 2013

Owner

@fhackenberger hi!
I reverted this changes. Unfortunately they are not working as expected. Please check this demo page http://morr.github.com/appear.scroll.html and try to scroll overflowed div.
Overflowed elements became "appeared" even when they are not visible. It is not enough just to add additional event handler for overflow=scroll containers, you have to consider this situation in "process" function. Unfortunately it is not very efficient and it is rather complicated check.

}

Expand Down

0 comments on commit 0940aef

Please sign in to comment.