jipe_app/app/assets/javascripts/cirques.js.coffee
2017-08-14 10:53:30 +02:00

73 lines
1.1 KiB
CoffeeScript

#= require jquery
#= require jquery_ujs
#= require ./vendor/jquery.scrollify
#=require ./popover
top = 20
@scroll_ajust = () ->
var_scroll = $(window).scrollTop()
@resize = () ->
$(".with_ratio").each ->
ratio = parseFloat($(this).data("ratio"))
height = $(this).width()*ratio
$(this).css("height",height+"px")
donate_pannel_height= 0
$(".lien_don .desc").css "height", "auto"
$(".lien_don .desc").each ->
if $(this).height() > donate_pannel_height
donate_pannel_height = $(this).height()
$(".lien_don .desc").css("height", donate_pannel_height+"px")
$('section .inner').each ->
element = $(this)
if $(this).data("text-position") == "top"
margin = ((($(window).height()-element.height())/ 3)*1)
if margin > 0
element.css('margin-top': margin+'px')
else
margin = ((($(window).height()-element.height())/ 8)*5)
if margin > 0
element.css('margin-top': margin+'px')
scroll_ajust()
$ ->
$(window).on "resize", ->
resize()
resize()