1
0
mirror of https://github.com/pattern-lab/patternlab-php.git synced 2025-01-17 22:29:12 +01:00

adding support for resizing the viewport on orientation change for mobile

This commit is contained in:
Dave Olsen 2014-01-24 15:46:02 -05:00
parent 6fb9b0c274
commit cb5bf6309f

View File

@ -431,6 +431,17 @@
$('#sg-vp-wrap').click(function() {
closePanels();
});
// Listen for resize changes
var origOrientation = window.orientation;
window.addEventListener("orientationchange", function() {
if (window.orientation != origOrientation) {
$("#sg-gen-container").width($(window).width());
$("#sg-viewport").width($(window).width());
updateSizeReading($(window).width());
origOrientation = window.orientation;
}
}, false);
// watch the iframe source so that it can be sent back to everyone else.
// based on the great MDN docs at https://developer.mozilla.org/en-US/docs/Web/API/window.postMessage