Skip to content

Instantly share code, notes, and snippets.

@hcliff
Created September 21, 2012 19:46
Show Gist options
  • Save hcliff/3763484 to your computer and use it in GitHub Desktop.
Save hcliff/3763484 to your computer and use it in GitHub Desktop.
$(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