Je suis novice en js, j'ai installé deux scripts sur mon site crée avec Spip 1.9, le 1er pour gérer un menu déroulant en cascade et le 2ème pour gérer la position du pied de page du site.
Quand ils sont utilisés à part, cela marche très bien, mais en même temps je n'ai que la fonction pied de page qui fonctionne.
Connaissant pas grand chose au code js, je pense qu'il y a un conflit, peut être de variable...
Voici le code utilisé pour le menu déroulant (trouvé sur http://www.spip-contrib.net/Menu-en-...ut#forum387099) :
Code : Tout sélectionner
function hover(obj){
if(document.all){
UL = obj.getElementsByTagName('ul');
if(UL.length > 0){
sousMenu = UL[0].style;
if(sousMenu.display == 'none' || sousMenu.display == ''){
sousMenu.display = 'block';
}else{
sousMenu.display = 'none';
}
}
}
}
function setHover(id){
LI = document.getElementById(id).getElementsByTagName('li');
nLI = LI.length;
for(i=0; i < nLI; i++){
LI[i].onmouseover = function(){
hover(this);
}
LI[i].onmouseout = function(){
hover(this);
}
}
}Code : Tout sélectionner
function getWindowHeight() {
var windowHeight = 0;
if (typeof(window.innerHeight) == 'number') {
windowHeight = window.innerHeight;
}
else {
if (document.documentElement && document.documentElement.clientHeight) {
windowHeight = document.documentElement.clientHeight;
}
else {
if (document.body && document.body.clientHeight) {
windowHeight = document.body.clientHeight;
}
}
}
return windowHeight;
}
function setFooter() {
if (document.getElementById) {
var windowHeight = getWindowHeight();
if (windowHeight > 0) {
var contentHeight = document.getElementById('page').offsetHeight;
var footerElement = document.getElementById('pied');
var footerHeight = footerElement.offsetHeight;
if (windowHeight - (contentHeight + footerHeight) >= 0) {
footerElement.style.position = 'relative';
footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
}
else {
footerElement.style.position = 'static';
}
}
}
}
window.onload = function() {
setFooter();
}
window.onresize = function() {
setFooter();
}