bievre_app/app/assets/javascripts/public.js.coffee
Caroline Girard dee35396f0 initial
2018-09-07 11:04:43 +02:00

82 lines
1.0 KiB
CoffeeScript

#= require jquery
#= require jquery_ujs
#menu deroulant
@scroll_ajust = () ->
var_scroll = $(window).scrollTop()
top_offset = $('#menu_container').offset().top
if var_scroll > top_offset
$("#menu").addClass("move_menu")
else
$("#menu").removeClass("move_menu")
@resize = () ->
$(".with_ratio").each ->
ratio = parseFloat($(this).data("ratio"))
height = $(this).width()*ratio
$(this).css("height",height+"px")
$(".desc").each ->
$(this).css("margin-top", "0px")
if $(window).width() > 800
height = $(this).height()
container_height = $(this).closest(".row").height()
margin_top = (container_height - height)/ 2
$(this).css("margin-top", margin_top+"px")
scroll_ajust()
$ ->
$(window).on "resize", ->
resize()
resize()
$(document).on "scroll", ->
scroll_ajust()
$(document).on "touchmove", ->
scroll_ajust()
resize()