210 lines
4.6 KiB
CoffeeScript

#= require jquery
#= require jquery_ujs
#= require ./vendor/jquery.flexslider
#= require ./vendor/markerclusterer
#= require ./vendor/jquery.mask
#= require ./vendor/jquery.fitvids
#= require ./vendor/jquery.bxslider
#= require redactor
#= require redactor_plugins/fontsize
#= require redactor_plugins/fontfamily
#= require redactor_plugins/fontcolor
#=require ./popover
top = 20
@scroll_ajust = () ->
var_scroll = $(window).scrollTop()
#right petition
rp_top_start = 0
rp_menu_top_container_height = $("#menu_top_container").outerHeight()
rp_window_height = $(window).height()
rp_right_petition_height = $(".new_petition .right_pad").outerHeight() + 60
rp_left_petition_height = $(".new_petition .left_pad").outerHeight()
rp_top_stop = rp_left_petition_height - rp_window_height + 150
#alert rp_left_petition_height
lambda = rp_window_height - rp_menu_top_container_height - rp_right_petition_height
if lambda < 0
rp_top_start = (lambda * -1)
if var_scroll >= rp_top_start
if var_scroll >= rp_top_stop
rp_top_value = rp_top_stop - rp_top_start
else
rp_top_value = var_scroll - rp_top_start
$(".new_petition .right_pad").css
"top" : rp_top_value
else
$(".new_petition .right_pad").css
"top" : 0
#alert rp_top_start
#menu
if var_scroll > top
$(".sub_menu_bar").addClass("move_top")
$("#menu_top_container").addClass("move_top")
else
$(".sub_menu_bar").removeClass("move_top")
$("#menu_top_container").removeClass("move_top")
#top_link
if var_scroll > 100
$(".top_link").css
"opacity" : 1
else
$(".top_link").css
"opacity" : 0
@resize = () ->
top = $("#menu_top_container").outerHeight()
$("body").css("padding-top", $("#menu_top_container").outerHeight()+"px");
scroll_ajust()
#$(".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")
$(".article-2x-2, .article-small").each ->
ratio = parseFloat($(this).data("ratio"))
height = $(this).find(".inner").width()*ratio
$(this).find(".inner").css("height",height+"px")
title_height = $(this).find(".read_more").outerHeight()
margin = (height-title_height-20-2)/ 2
$(this).find(".read_more").css("margin-top",margin+"px")
test = 10
#$("#home_slider").css("height", ($("#main").width()*(640 / 1200))+"px")
$(".menu_item_top").css("min-height", ($(".widther").width()*(450 / 1200))+"px")
$(".article_top").css("height", ($(".article_top").width()*(480 / 1200))+"px")
left_size = ($(".right_follow .menu_itemlink_content:first").outerHeight()*2)+20
$(".left_follow").css
"min-height" :left_size+"px"
image_actu_size = $(".home_articles:first").outerHeight()
$(".home_image_actus .inner:first").css
"min-height" :image_actu_size+"px"
#//alert $("#main").width()*0.75
if $(".widther").width() > 800
dim = Math.round($(".widther").width()*0.70*(9 / 16))
else
dim = Math.round($(".widther").width()*1*(9 / 16))
banner_padding = parseInt($("#slider_banner").data("padding"))
$("#slider_banner").css("height", (dim+banner_padding)+"px")
$("#slider_right .inner").css
"height" : dim+"px"
$("#slider_left").css
"height" : dim+"px"
$(".with_ratio").each ->
ratio = parseFloat($(this).data("ratio"))
height = $(this).width()*ratio
$(this).css("height",height+"px")
petition_height= 0
$(".petition_line_inner").each ->
if $(this).height() > petition_height
petition_height = $(this).height()
$(".petition_line .petition_line_inner").css("height", petition_height+"px")
$ ->
$(window).on "resize", ->
resize()
resize()
$(".flashs .remove").click ->
$(this).parent().remove()
$(document).on "scroll", ->
scroll_ajust()
$(document).on "touchmove", ->
scroll_ajust()
$(".top_link").click ->
$('html,body').animate({scrollTop: 0},'slow');
$(document).on "click", ".specific_detail", ->
$('html,body').animate({scrollTop: $(".detail_inner").offset().top},'slow');