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

38 lines
988 B
CoffeeScript
Raw Normal View History

2013-07-25 23:33:04 +02:00
window.handleResize = () ->
windowHeight = $(window).height()
$siteBody = $ '.site-body'
2013-08-13 07:11:14 +02:00
$siteBody.height windowHeight - $('header').height()
2013-07-25 23:33:04 +02:00
$('.dropdown-menu').each () ->
$this = $ this
newMaxHeight = windowHeight - $this.parent().offset().top - $this.parent().height() - 5
$this.css
'max-height': newMaxHeight
2013-07-28 19:45:21 +02:00
$('.stretch-to-bottom').each () ->
2013-07-25 23:33:04 +02:00
$this = $ this
2013-08-13 07:11:14 +02:00
newHeight = windowHeight - $this.offset().top
2013-07-30 06:53:57 +02:00
if newHeight > 0
2013-07-29 22:54:53 +02:00
$this.height newHeight
2013-07-25 23:33:04 +02:00
$('.revealable').each () ->
$this = $ this
2013-08-01 04:01:41 +02:00
return if $this.data 'real-height'
$this.data 'real-height', $this.height()
$this.css
height: '15em'
$this.find('.reveal').click (e) ->
e.preventDefault()
$this.css {height: 'auto'}
$(this).fadeOut 200
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()