Created
September 21, 2012 19:46
-
-
Save hcliff/3763484 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$(window).on 'message', | |
# Inform the parent if the size of the widget changes | |
height = 0 | |
setInterval -> | |
# Get the dimensions of the current board | |
bounding = $('#grid').get(0).getBoundingClientRect() | |
if bounding.top isnt bounding.bottom | |
newHeight = Math.ceil(bounding.top + bounding.bottom) | |
# If the height has changed, save the new height | |
# and tell the parent window | |
unless _.isEqual height, newHeight | |
height = newHeight | |
window.parent.postMessage JSON.stringify( | |
fragment : 'resize' | |
height : height | |
), '*' | |
, 250 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment