Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guarantee resize event is always bound to window element #443

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion lib/jquery.waypoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
this.element = element
this.Adapter = Waypoint.Adapter
this.adapter = new this.Adapter(element)
this.windowAdapter = new this.Adapter(window);
this.key = 'waypoint-context-' + keyCounter
this.didScroll = false
this.didResize = false
Expand Down Expand Up @@ -227,7 +228,7 @@ https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
self.didResize = false
}

this.adapter.on('resize.waypoints', function() {
this.windowAdapter.on('resize.waypoints', function() {
if (!self.didResize) {
self.didResize = true
Waypoint.requestAnimationFrame(resizeHandler)
Expand Down
2 changes: 1 addition & 1 deletion lib/jquery.waypoints.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion lib/noframework.waypoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
this.element = element
this.Adapter = Waypoint.Adapter
this.adapter = new this.Adapter(element)
this.windowAdapter = new this.Adapter(window);
this.key = 'waypoint-context-' + keyCounter
this.didScroll = false
this.didResize = false
Expand Down Expand Up @@ -227,7 +228,7 @@ https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
self.didResize = false
}

this.adapter.on('resize.waypoints', function() {
this.windowAdapter.on('resize.waypoints', function() {
if (!self.didResize) {
self.didResize = true
Waypoint.requestAnimationFrame(resizeHandler)
Expand Down
2 changes: 1 addition & 1 deletion lib/noframework.waypoints.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion lib/zepto.waypoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
this.element = element
this.Adapter = Waypoint.Adapter
this.adapter = new this.Adapter(element)
this.windowAdapter = new this.Adapter(window);
this.key = 'waypoint-context-' + keyCounter
this.didScroll = false
this.didResize = false
Expand Down Expand Up @@ -227,7 +228,7 @@ https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
self.didResize = false
}

this.adapter.on('resize.waypoints', function() {
this.windowAdapter.on('resize.waypoints', function() {
if (!self.didResize) {
self.didResize = true
Waypoint.requestAnimationFrame(resizeHandler)
Expand Down
2 changes: 1 addition & 1 deletion lib/zepto.waypoints.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
this.element = element
this.Adapter = Waypoint.Adapter
this.adapter = new this.Adapter(element)
this.windowAdapter = new this.Adapter(window);
this.key = 'waypoint-context-' + keyCounter
this.didScroll = false
this.didResize = false
Expand Down Expand Up @@ -61,7 +62,7 @@
self.didResize = false
}

this.adapter.on('resize.waypoints', function() {
this.windowAdapter.on('resize.waypoints', function() {
if (!self.didResize) {
self.didResize = true
Waypoint.requestAnimationFrame(resizeHandler)
Expand Down