[1] | 1 | $(document).ready |
---|
| 2 | ( function () |
---|
| 3 | { init_menu_slide(); |
---|
| 4 | init_thickbox(); |
---|
| 5 | init_news_box(); |
---|
| 6 | //init_defil(); |
---|
| 7 | } |
---|
| 8 | ); |
---|
| 9 | |
---|
| 10 | // ---------------------------------------- menus defilants |
---|
| 11 | |
---|
| 12 | var obj = null; |
---|
| 13 | |
---|
| 14 | function checkHover() |
---|
| 15 | { if(obj) obj.find('ul').fadeOut('fast'); |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | function init_menu_slide() |
---|
| 19 | { $('.menu_name').hover |
---|
| 20 | ( function() |
---|
| 21 | { if(obj) |
---|
| 22 | { obj.find('ul').fadeOut('fast'); |
---|
| 23 | obj = null; |
---|
| 24 | } |
---|
| 25 | $(this).find('ul').fadeIn('fast'); |
---|
| 26 | }, |
---|
| 27 | function() |
---|
| 28 | { obj = $(this); |
---|
| 29 | setTimeout("checkHover()", 80); |
---|
| 30 | } |
---|
| 31 | ); |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | // ---------------------------------------- artistes au hasard |
---|
| 36 | |
---|
| 37 | var current_left = 0; |
---|
| 38 | var dx = 15; |
---|
| 39 | var vitesse = 1; |
---|
| 40 | var move_delay = 50; |
---|
| 41 | |
---|
| 42 | var sens = 0; |
---|
| 43 | var dv_width = 671; |
---|
| 44 | var dv_height = 60; |
---|
| 45 | var dvc_width = 0; |
---|
| 46 | |
---|
| 47 | var MOVING = false; |
---|
| 48 | |
---|
| 49 | function init_defil() |
---|
| 50 | { set_dvc_width(); |
---|
| 51 | setInterval("move()", move_delay); |
---|
| 52 | if(document.addEventListener) document.addEventListener("mousemove", check_defil, false); |
---|
| 53 | else if(document.attachEvent) document.attachEvent("onmousemove", check_defil); |
---|
| 54 | else document.onmousemove = check_defil; |
---|
| 55 | _defil_view(); |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | function set_dvc_width() |
---|
| 59 | { dvc_width = document.getElementById("defil_viewer_content").offsetWidth; |
---|
| 60 | document.getElementById("defil_viewer").style.width="" + dv_width + "px"; |
---|
| 61 | document.getElementById("defil_viewer").style.margin="0px 7px 0px 7px"; |
---|
| 62 | document.getElementById("defil_viewer").style.clip="rect(0px 0px 0px 0px)"; |
---|
| 63 | document.getElementById("defil_viewer").style.overflow="hidden"; |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | function defil_view(_sens) { sens = _sens; } |
---|
| 67 | |
---|
| 68 | function get_obj(id) |
---|
| 69 | { if(document.getElementById) return document.getElementById(id); |
---|
| 70 | else if(document.all) return document.all[id]; |
---|
| 71 | return -1; |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | function _defil_view() |
---|
| 75 | { move(); |
---|
| 76 | setTimeout("_defil_view()", move_delay); |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | function move() |
---|
| 80 | { if(sens != 0) |
---|
| 81 | { var next_left = current_left + (dx * vitesse * sens); |
---|
| 82 | if(dvc_width > dv_width && next_left < 30 && next_left > (dv_width - dvc_width)) |
---|
| 83 | { current_left = next_left; |
---|
| 84 | $("#defil_viewer_content").animate({left: "" + current_left + "px"}, move_delay); |
---|
| 85 | } |
---|
| 86 | } |
---|
| 87 | } |
---|
| 88 | |
---|
| 89 | function check_defil(e) |
---|
| 90 | { var mx = 0; |
---|
| 91 | var my = 0; |
---|
| 92 | if (!e) var e = window.event; |
---|
| 93 | if (e.pageX || e.pageY) |
---|
| 94 | { mx = e.pageX; |
---|
| 95 | my = e.pageY; |
---|
| 96 | } |
---|
| 97 | else if (e.clientX || e.clientY) |
---|
| 98 | { mx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; |
---|
| 99 | my = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; |
---|
| 100 | } |
---|
| 101 | elt = document.getElementById("defil_viewer"); |
---|
| 102 | divx = 0; |
---|
| 103 | divy = 0; |
---|
| 104 | while(elt != null && elt.tagName != 'BODY' && elt.tagName != 'body') |
---|
| 105 | { divx += elt.offsetLeft; |
---|
| 106 | divy += elt.offsetTop; |
---|
| 107 | elt = elt.offsetParent; |
---|
| 108 | } |
---|
| 109 | posx = mx - divx; |
---|
| 110 | posy = my - divy; |
---|
| 111 | if(posx > 0 && posy > 0 && posx < dv_width && posy < dv_height) |
---|
| 112 | { if(posx > 6 * (dv_width / 8)) |
---|
| 113 | { sens = -1; |
---|
| 114 | if(posx < 7 * (dv_width / 8)) vitesse = 1; |
---|
| 115 | else vitesse = 2; |
---|
| 116 | } |
---|
| 117 | else if(posx < 2 * (dv_width / 8)) |
---|
| 118 | { sens = 1; |
---|
| 119 | if(posx > (dv_width / 8)) vitesse = 1; |
---|
| 120 | else vitesse = 2; |
---|
| 121 | } |
---|
| 122 | else sens = 0; |
---|
| 123 | } |
---|
| 124 | else sens = 0; |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | // ---------------------------------------- news box |
---|
| 128 | |
---|
| 129 | function init_news_box() |
---|
| 130 | { $(".news_actegories_menu").hover |
---|
| 131 | ( function() |
---|
| 132 | { $(".news_actegories_menu ul").slideDown(200); |
---|
| 133 | }, |
---|
| 134 | function() |
---|
| 135 | { $(".news_actegories_menu ul").slideUp(200); |
---|
| 136 | } |
---|
| 137 | ); |
---|
| 138 | } |
---|