ballalama3_app/app/assets/javascripts/application.js.coffee
2017-09-13 23:54:16 +02:00

96 lines
1.6 KiB
CoffeeScript

#= require jquery
#= require jquery_ujs
#= require jquery.validationEngine.js
#= require jquery.validationEngine-fr.js
#= require ./jquery.backstretch.min.js
#= require jquery.superslides
#= require jquery.easing.1.3
#=require ./popover
bottom = 0
prev_link = ""
$ ->
$(".top_link").click ->
$('html,body').animate({scrollTop: 0},'slow');
resize = ->
$(".slider").each ->
$(this).css({"width": $(this).parent().width()+"px"})
height = ($(window).height())
optimal_height = Math.round($(this).width()/ 2.73)
if optimal_height < height
height = optimal_height
$(this).css({"height": height+"px"})
$(".rea-gal").each ->
$(this).find("img").css "width", Math.floor(((100) )/ 5)+"%"
$("#large").css "min-height", ($(window).height()-30)+"px"
$.backstretch("/fond.jpg")
resize()
$(window).on "resize", ->
resize()
$(".slider .slides").superslides
inherit_width_from: ".slider"
inherit_height_from: ".slider"
play: 6000
animation_speed: 3000
animation_easing: "swing"
@scroll_ajust = ->
var_scroll = $(window).scrollTop()
if( $(this).scrollTop() <= 300 )
top = 300 - $(this).scrollTop()
$("#menu").removeClass "scroll"
else
top = 0
$("#menu").addClass "scroll"
$("#menu").css
top : top
if var_scroll > 100
$(".top_link").css
"opacity" : 1
else
$(".top_link").css
"opacity" : 0
$(document).on "scroll", () ->
scroll_ajust()
$(document).on "touchmove", () ->
scroll_ajust()