1 $(function(){ |
1 $(function(){ |
2 var sum=0; |
2 //CLUSTER |
3 $('.cluster li').each( function(){ sum += $(this).width(); }); |
3 var clusterWidth=0; |
4 $('.cluster').width( sum ); |
4 $('.cluster li').each( function(){ clusterWidth += $(this).width() + 10; }); |
|
5 $('.cluster').width( clusterWidth ); |
|
6 var clusterVisibleWidth = $(".cluster-visible").width(); |
|
7 var clusterVisibleLeft = 20; |
|
8 if (clusterWidth>clusterVisibleWidth) { |
|
9 $(".cluster-containment").css({ |
|
10 "left": -(clusterWidth-clusterVisibleWidth), |
|
11 "width":clusterWidth+(clusterWidth-clusterVisibleWidth+clusterVisibleLeft) |
|
12 }); |
|
13 $(".cluster-visible").css({"left": (clusterWidth-912+clusterVisibleLeft)}); |
|
14 $("a.cluster-arrow").bind("click",function(e){ |
|
15 console.log("click") |
|
16 e.preventDefault(); |
|
17 var clusterContainmentLeft = parseInt($(".cluster-containment").css("left")); |
|
18 var clusterContainmentRight = parseInt($(".cluster-containment").css("left")) + $(".cluster-containment").width(); |
|
19 var clusterLeft = parseInt($(".cluster").css("left")); |
|
20 var clusterRight = parseInt($(".cluster").css("left"))+$(".cluster").width(); |
|
21 if ($(this).hasClass("arrow-left")) { |
|
22 if (clusterLeft-40>clusterContainmentLeft) { |
|
23 $(".cluster").css({ |
|
24 "left":"-="+40 |
|
25 }); |
|
26 }else{ |
|
27 $(".cluster").css({ |
|
28 "left":clusterContainmentLeft |
|
29 }); |
|
30 } |
|
31 |
|
32 }else if($(this).hasClass("arrow-right")){ |
|
33 |
|
34 if (clusterRight+40<clusterContainmentRight) { |
|
35 $(".cluster").css({ |
|
36 "left":"+="+40 |
|
37 }); |
|
38 }else{ |
|
39 $(".cluster").css({ |
|
40 "left":0 |
|
41 }); |
|
42 } |
|
43 } |
|
44 |
|
45 }); |
|
46 |
|
47 |
|
48 //DRAGGABLE |
|
49 $(".cluster").draggable({ axis: "x",containment: ".cluster-containment" }); |
|
50 }; |
|
51 //WIDGET |
|
52 //$("div.content-left div.widget-wrap div.widget div.widget-inner").hide(); |
|
53 $("div.content-left div.widget-wrap div.widget h3 a").bind("click",function(e){ |
|
54 e.preventDefault(); |
|
55 var widgetInner = $(this).parents("h3").siblings("div.widget-inner"); |
|
56 widgetInner.stop(); |
|
57 if ($(this).hasClass("open")) { |
|
58 widgetInner.slideUp(); |
|
59 $(this).removeClass("open"); |
|
60 }else{ |
|
61 widgetInner.slideDown(); |
|
62 $(this).addClass("open"); |
|
63 } |
|
64 }); |
|
65 //DOCUMENTAIRE |
|
66 $("div.dossier-documentaire").hide(); |
|
67 $("div.header a.dossier-button").bind("click",function(e){ |
|
68 e.preventDefault(); |
|
69 $("div.dossier-documentaire").stop() |
|
70 if($("div.dossier-documentaire").is(":visible")){ |
|
71 $("div.dossier-documentaire").slideUp(); |
|
72 }else{ |
|
73 $("div.dossier-documentaire").slideDown(); |
|
74 } |
|
75 }); |
|
76 //ARTICLES |
|
77 $(".article-visuel-wrap").each(function(){ |
|
78 var contentHeight = $(this).parents(".article-content").height(); |
|
79 |
|
80 //$(this).height(contentHeight); |
|
81 }); |
|
82 |
|
83 |
5 |
84 |
6 }); |
85 }); |