Pony.fm/public/scripts/shared/layout.coffee

25 lines
633 B
CoffeeScript
Raw Normal View History

2013-07-25 23:33:04 +02:00
window.handleResize = () ->
windowHeight = $(window).height()
$siteBody = $ '.site-body'
$siteBody.height windowHeight - $('header').height() - 1
2013-07-29 22:54:53 +02:00
redo = false
2013-07-25 23:33:04 +02:00
2013-07-28 19:45:21 +02:00
$('.stretch-to-bottom').each () ->
2013-07-25 23:33:04 +02:00
$this = $ this
2013-07-29 22:54:53 +02:00
newHeight = windowHeight - $this.offset().top + 1
if newHeight <= 0
redo = true
else
$this.height newHeight
2013-07-25 23:33:04 +02:00
2013-07-29 22:54:53 +02:00
window.setTimeout(window.handleResize, 0) if redo
2013-07-28 23:51:35 +02:00
2013-07-27 02:15:07 +02:00
window.alignVertically = (element) ->
$element = $(element)
$parent = $element.parent()
$element.css 'top', $parent.height() / 2 - $element.height() / 2
2013-07-25 23:33:04 +02:00
window.handleResize()
$(window).resize window.handleResize
$('.site-content').empty()