#= require jquery #= require jquery_ujs #= require jquery.superslides #= require jquery.easing.1.3 #= require jquery.animate-enhanced.min #= require jquery.tagcanvas #= require jquery.bxslider.min @scrollToAnchor = (aid) -> aTag = $("#" + aid ) $("html,body").animate({scrollTop: aTag.offset().top}, 1000) return bottom = 0 prev_link = "" $("document").ready -> position_img_now = -> imgheight = $("#large .large-img").outerHeight() + $("#large h3").outerHeight() margintop = (( $(window).height() - imgheight) / 2 ) $("#large .large-img").css "margin-top" :(margintop+"px") #"width" : "100px" position_img = -> $("#large .large-img").one "load", -> position_img_now() $("#rea-gal a").click -> maxwidth = 1000 maxheight = 900 prev_link = $(this) $("body").append "
" title = false $("#large").append "" $("#large").append "" $("#large").append "
" $(".img_container.first").append "" if $(this).attr "title" title = $(this).attr "title" $(".img_container.first").append "

"+title+"

" $("#large .large-img").one "load", -> $("#large").fadeIn(500) position_img(); if $(window).height() > (maxheight+100) $("#large .large-img").css "max-height" : maxheight else $("#large .large-img").css "max-height" : "85%" if $(window).width() > (maxwidth+100) $("#large .large-img").css "max-width" : maxwidth else $("#large .large-img").css "max-width" : "85%" position_img(); false $("body").on "click", "#large", -> $(this).fadeOut 300, -> $(this).remove() $("body").on "click" ,"#large .prev",-> if prev_link.prev("a").length > 0 link = prev_link.closest("a").prev("a") else link = prev_link.closest("div").children("a:last") #titre = photo.find("h3") $(".img_container.first").fadeOut 300, -> $("#large h3").remove() if link.attr "title" title = link.attr "title" $(".img_container.first").append "

"+title+"

" $('#large .large-img').attr("src", link.attr("href")) $("#large .large-img").one "load", -> $(".img_container.first").fadeIn() position_img(); prev_link = link false $("body").on "click" ,"#large .next",-> if prev_link.next("a").length > 0 link = prev_link.closest("a").next("a") else link = prev_link.closest("div").children("a:first") #titre = photo.find("h3") $(".img_container.first").fadeOut 300, -> $("#large h3").remove() if link.attr "title" title = link.attr "title" $(".img_container.first").append "

"+title+"

" $('#large .large-img').attr("src", link.attr("href")) $("#large .large-img").one "load", -> $(".img_container.first").fadeIn() position_img(); prev_link = link false $('.gal').bxSlider adaptiveHeight: true, auto: true, speed:1000, pause:5000, # $(".infos").hide(); $(".infos-button").click -> $(this).next(".infos").slideToggle() $("html,body").animate({scrollTop: ($(this).offset().top-60)}, 500) left =0 top = 0 offset= 0 resize = -> $("#rea-gal img").css "width", ($(window).width() - 6 * 5 )/ 5 $(".slider").css({"height": ($(window).height())+"px","width": $(window).width()+"px" }) $("#brainstorming").css({"height": ($(window).height())+"px","width": $(window).width()+"px" }) $("#myCanvas").attr({height: ($(window).height()-160),"width": $(window).width() }) $("#menu-container").css("top",($(window).height()-50)+"px") $("#main").css("top",($(window).height())) $("#logo").one("load", -> #offset = $("#logo").offset().top-100 left = ($(window).width() - $("#logo").width()) / 2 bottom = ($(window).height() - $("#logo").height() - $("#baseline").height() - 40)/ 1.10 $("#logo").css({"top": bottom+"px","left": left+"px"}) $("#baseline").css({"top": (bottom+$("#logo").height())+"px","left": left+"px"}) #baseline antiGrav = (ele) -> # anti-gravity floating on an element ;) distance = 5 $(ele).animate left: "=" + top + distance + "px" , 2000, "easeInOutBounce", -> $(ele).animate left: "=" + top - distance + "px" , 1800, "easeInOutBounce", -> antiGrav ele return return return antiGrav2 = (ele) -> # anti-gravity floating on an element ;) distance = 4 $(ele).animate top: "-=" + distance + "px" , 2000, "swing", -> $(ele).animate top: "+=" + distance + "px" , 2300, "swing", -> antiGrav2 ele return return return antiGrav2(".wide-container") ).each -> $(this).load() if @complete return position_img_now(); $(window).on "scroll", -> top = $(window).scrollTop() #$(".wide-container").css("top", top-10) if $(window).scrollTop() > ($(window).height()-50) $("#menu").css("position", "fixed") else $("#menu").css("position", "relative") if $(window).scrollTop() > bottom-100 $("#logo").fadeOut() $("#baseline").fadeOut() $("#logo-min").fadeIn() else if $(window).scrollTop() < bottom+100 $("#logo").fadeIn() $("#baseline").fadeIn() $("#logo-min").fadeOut() if top > ($("#realisations").offset().top - $(window).height() / 2) #alert "te" $("#realisations #rea-gal").animate({left:0,opacity : 1}, 800, "swing") resize() $(window).on "resize", -> resize()