Created
June 4, 2014 20:57
-
-
Save buritica/113c6a5ab103d80f6a1b to your computer and use it in GitHub Desktop.
Celtra orientation detection for Onswipe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getDocDimensions() { | |
var D = window.parent.parent.document; | |
return [ | |
D.documentElement.clientWidth, | |
D.documentElement.clientHeight | |
]; | |
} | |
function getOrientation() { | |
var dimensions = getDocDimensions(); | |
console.log('dimensions', dimensions); | |
if (dimensions[0] > dimensions[1]) { | |
return 'Landscape'; | |
} else { | |
return 'Portrait'; | |
} | |
} | |
function setCreativeOrientation(orientation) { | |
var adScreen = unit.find(orientation); | |
unit.goToScreenAction(ctx, {screen: adScreen}, c); | |
} | |
var orientation = getOrientation(); | |
setCreativeOrientation(orientation); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment