idn_app/app/assets/javascripts/public.js.coffee
Nicolas Bally c25824013c suite
2016-07-25 19:22:26 +02:00

83 lines
1.5 KiB
CoffeeScript

#= require jquery
#= require jquery_ujs
#= require ./vendor/jquery.flexslider
#=require ./popover
$ ->
top = 120
resize = () ->
#$(".bxslider li").each ->
# width = $(this).parent().width()
# $(this).css("width",$(this).parent().width()+"px")
$("#main").css
"min-height" :$(window).height()+"px"
#$(this).closes
$(".menu_itemlink_content").css("height", "auto");
$(".menu_itemlink_content").each ->
ratio = parseFloat($(this).data("ratio"))
height = $(this).width()*ratio
$(this).css("height",height+"px")
title_height = $(this).find(".title").height()
margin = (height-title_height-2)/ 2
$(this).find(".title").css("margin-top",margin+"px")
test = 10
$("#home_slider").css("height", ($("#main").width()*(9 / 26))+"px")
$("#home_slider .inner").css("height", ($("#main").width()*(9 / 26))+"px")
$(window).on "resize", ->
resize()
resize()
$(document).on "scroll", ->
scroll_ajust()
$(document).on "touchmove", ->
scroll_ajust()
scroll_ajust = () ->
var_scroll = $(window).scrollTop()
if var_scroll > top
$("#top_bar").addClass("move_top")
else
$("#top_bar").removeClass("move_top")
if var_scroll > top
$(".top_link").css
"opacity" : 1
else
$(".top_link").css
"opacity" : 0
$(".top_link").click ->
$('html,body').animate({scrollTop: 0},'slow');