82 lines
1.0 KiB
CoffeeScript
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()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|