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

37 lines
953 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-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
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'
2013-08-01 04:01:41 +02:00
# if $this.height() > $this.data 'real-height'
# $this.css {height: 'auto'}
# $this.find('.reveal').css {display: 'none'}
# return
$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()