From 03479065839b10ba6326efb67f244c06aed03291 Mon Sep 17 00:00:00 2001 From: renato <renato@rezo.net> Date: Mon, 6 Nov 2006 16:54:52 +0000 Subject: [PATCH] speed up changestyle. it is important because it is called when moving the mouse over the page --- dist/javascript/presentation.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dist/javascript/presentation.js b/dist/javascript/presentation.js index 0d962ef08c..7031010c5e 100644 --- a/dist/javascript/presentation.js +++ b/dist/javascript/presentation.js @@ -1,16 +1,17 @@ -var init_gauche = true; +var bandeau_elements = false; function changestyle(id_couche, element, style) { // La premiere fois, regler l'emplacement des sous-menus - if (init_gauche) { - init_gauche = false; + if (!bandeau_elements) { + bandeau_elements = $('#haut-page div.bandeau'); if (bug_offsetwidth) { $('#bandeau-principal div.bandeau').each(function(){ - if (parseInt(this.style.left) > 0) { + var left = parseInt(this.style.left); + if (left > 0) { demilargeur = Math.floor( this.offsetWidth / 2 ); if (demilargeur == 0) demilargeur = 100; // bug offsetwidth MSIE, on fixe une valeur arbitraire - gauche = parseInt(this.style.left) + gauche = left - demilargeur + Math.floor(largeur_icone / 2); if (gauche < 0) gauche = 0; @@ -21,7 +22,7 @@ function changestyle(id_couche, element, style) { } // Masquer les elements du bandeau - var select = $('#haut-page div.bandeau').not('#'+id_couche); + var select = $(bandeau_elements).not('#'+id_couche); // sauf eventuellement la boite de recherche si la souris passe en-dessous if (id_couche=='garder-recherche') select = select.not('#bandeaurecherche'); select.css('visibility','hidden'); -- GitLab