Skip to content

Commit

Permalink
Merge pull request #2 from erikreyna/master
Browse files Browse the repository at this point in the history
Adding option to trigger crossfade before we get to object
  • Loading branch information
mikefowler committed May 5, 2015
2 parents 1e3d98b + 9858919 commit b6c94b0
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 b6c94b0

Please sign in to comment.