Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions jquery.scrolly.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,11 @@
this.velocity = this.$element.attr('data-velocity');
this.bgStart = parseInt(this.$element.attr('data-fit'), 10);

$(document).scroll(function(){
$(document).bind('scroll', function(){
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think bind is deprecated, no? Maybe I'm wrong, but we should try to use on instead.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you're right!
As seen in http://stackoverflow.com/questions/11847021/jquery-bind-vs-on, bind maps to on, but will be deprecated!

self.didScroll = true;
self.scrolly();
});

setInterval(function() {
if (self.didScroll) {
self.didScroll = false;
self.scrolly();
}
}, 10);
self.scrolly();
};

Plugin.prototype.scrolly = function() {
Expand All @@ -70,7 +65,7 @@
if(this.bgStart){ position = position + this.bgStart; }

if(this.options.bgParallax === true) {
this.$element.css({backgroundPosition: '50% '+position+'px'});
this.$element.css({backgroundPosition: (this.options.horizontalPos || '50%') + ' ' + position+'px'});
} else {
this.$element.css({top: position});
}
Expand Down