Skip to content
This repository has been archived by the owner on Jan 24, 2018. It is now read-only.

Width and height are updated incorrectly after orientationchange event #467

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
22 changes: 12 additions & 10 deletions src/skrollr.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,21 +290,23 @@
//Triggers parsing of elements and a first reflow.
_instance.refresh();

var requestAnimFrame = polyfillRAF();

_addEvent(window, 'resize orientationchange', function() {
var width = documentElement.clientWidth;
var height = documentElement.clientHeight;
requestAnimFrame(function() {
var width = documentElement.clientWidth;
var height = documentElement.clientHeight;

//Only reflow if the size actually changed (#271).
if(height !== _lastViewportHeight || width !== _lastViewportWidth) {
_lastViewportHeight = height;
_lastViewportWidth = width;
//Only reflow if the size actually changed (#271).
if(height !== _lastViewportHeight || width !== _lastViewportWidth) {
_lastViewportHeight = height;
_lastViewportWidth = width;

_requestReflow = true;
}
_requestReflow = true;
}
});
});

var requestAnimFrame = polyfillRAF();

//Let's go.
(function animloop(){
_render();
Expand Down