Skip to content

Commit

Permalink
Added option for extra offset, making it possible to trigger the cros…
Browse files Browse the repository at this point in the history
…sfade before getting to the top of the target object. Reintroducing PR because previous PR had eliminated trailing whitespaces, making the diff hell to look at.
  • Loading branch information
erikreyna committed Apr 30, 2015
1 parent 1e3d98b commit 9858919
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/crossfade.jquery.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/crossfade.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
Crossfade.prototype.onScroll = function () {

var scrollTop = $(window).scrollTop();
var elementOffsetTop = this.el.offset().top;
var elementOffsetTop = this.el.offset().top - this.options.offset;
var elementHeight = this.el.height();
var percentage;

Expand Down Expand Up @@ -349,7 +349,8 @@

$.fn.crossfade.defaults = {
backgroundPosition: 'center center',
threshold: 0.5
threshold: 0.5,
offset: 0
};

// --------------------------------------------------------------------------
Expand Down

0 comments on commit 9858919

Please sign in to comment.