1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| function redim() {
var winW = document.documentElement.offsetWidth-80;//80= les marges droite + gauche.
var winH = document.documentElement.offsetHeight;
var winRatio = winW/winH;
var animRatio = origW/origH;
if(winRatio > animRatio){
animH = winH;//note: utilisation de variables globales!
animW = winH*animRatio;
} else {
animH = winW/animRatio;
animW = winW;
}
}
//disparition du titre avec délai:
function disparition() {
temp=document.getElementById('titre');
setTimeout('temp.style.display="none"',2600);
}
//apparition des liens au survol de l'image:
function liens() {
lien=document.getElementsByTagName('a');
for (var i=0;i<lien.length;i++) {
lien[i].style.display="block";
}
}
//initialisation:
function addEvent(obj, event, fct) {
if (obj.attachEvent) //Est-ce IE ?
obj.attachEvent("on" + event, fct); //Ne pas oublier le "on"
else
obj.addEventListener(event, fct, true);
}
addEvent(window, "load", disparition);
addEvent(window, "load", redim());
addEvent(document.getElementById('flashcontent'), "mousemove", liens);
//lancement:
function lancer(fct) {
addEvent(window, "load", fct);
} |
Partager