Joomla.it Forum
Joomla! 2.5 (versione con supporto terminato) => Joomla! 1.6/1.7/2.5 => : conti1 13 Jan 2011, 19:13:21
-
eccomi con un questo
mettere menu con tendina nel top menu,
premetto che il template lo fatto e de funzionante al 100% in joomla 1.5
qui joomla 1.5
http://www.webconti.altervista.org/
ora l riscritto x la 1.6 tutto bene fino a quando ho messo il menu la tendina resta aperta
joomla 1.6
http://contiweb16.altervista.org/index.php
e come se non vedesse lo script
questo è il codice dello script
in uso anche in joomla 1,5
if (typeof(MooTools) != 'undefined'){
var subnav = new Array();
Element.extend(
{
hide: function(timeout)
{
this.status = 'hide';
clearTimeout (this.timeout);
if (timeout)
{
this.timeout = setTimeout (this.anim.bind(this), timeout);
}else{
this.anim();
}
},
show: function(timeout)
{
this.status = 'show';
clearTimeout (this.timeout);
if (timeout)
{
this.timeout = setTimeout (this.anim.bind(this), timeout);
}else{
this.anim();
}
},
setActive: function () {
//this.addClass(classname);
this.className+='sfhover';
/*
for(var i=0;i<this.childNodes.length; i++) {
if(this.childNodes[i].nodeName.toLowerCase() == 'a') {
//$(this.childNodes[i]).addClass(classname);
$(this.childNodes[i]).setActive();
return;
}
}
*/
},
setDeactive: function () {
//this.removeClass(classname);
this.className=this.className.replace(new RegExp("sfhover\\b"), "");
/*
for(var i=0;i<this.childNodes.length; i++) {
if(this.childNodes[i].nodeName.toLowerCase() == 'a') {
$(this.childNodes[i]).setDeactive();
return;
}
}
*/
},
anim: function() {
if ((this.status == 'hide' && this.style.left != 'auto') || (this.status == 'show' && this.style.left == 'auto' && !this.hidding)) return;
this.setStyle('overflow', 'hidden');
if (this.status == 'show') {
this.hidding = 0;
this.hideAll();
//this.parentNode.setActive();
} else {
//this.parentNode.setDeactive();
}
if (this.status == 'hide')
{
this.hidding = 1;
//this.myFx1.stop();
this.myFx2.stop();
//this.myFx1.start(1,0);
if (this.parent._id) this.myFx2.start(this.offsetWidth,0);
else this.myFx2.start(this.offsetHeight,0);
} else {
this.setStyle('left', 'auto');
//this.myFx1.stop();
this.myFx2.stop();
//this.myFx1.start(0,1);
if (this.parent._id) this.myFx2.start(0,this.mw);
else this.myFx2.start(0,this.mh);
}
},
init: function() {
this.mw = this.clientWidth;
this.mh = this.clientHeight;
//this.myFx1 = new Fx.Style(this, 'opacity');
//this.myFx1.set(0);
if (this.parent._id)
{
this.myFx2 = new Fx.Style(this, 'width', {transition: Fx.Transitions.Quart.easeOut}, {duration: 300});
this.myFx2.set(0);
}else{
this.myFx2 = new Fx.Style(this, 'height', {transition: Fx.Transitions.Quart.easeOut}, {duration: 300});
this.myFx2.set(0);
}
this.setStyle('left', '-999em');
animComp = function(){
if (this.status == 'hide')
{
this.setStyle('left', '-999em');
this.hidding = 0;
}
this.setStyle('overflow', '');
}
this.myFx2.addEvent ('onComplete', animComp.bind(this));
},
hideAll: function() {
for(var i=0;i<subnav.length; i++) {
if (!this.isChild(subnav[i]))
{
subnav[i].hide(0);
}
}
},
isChild: function(_obj) {
obj = this;
while (obj.parent)
{
if (obj._id == _obj._id)
{
//alert(_obj._id);
return true;
}
obj = obj.parent;
}
return false;
}
});
var DropdownMenu = new Class({
initialize: function(element)
{
//$(element).mh = 0;
$A($(element).childNodes).each(function(el)
{
if(el.nodeName.toLowerCase() == 'li')
{
//if($(element)._id) $(element).mh += 30;
$A($(el).childNodes).each(function(el2)
{
if(el2.nodeName.toLowerCase() == 'ul')
{
$(el2)._id = subnav.length+1;
$(el2).parent = $(element);
subnav.push ($(el2));
el2.init();
el.addEvent('mouseover', function()
{
el.setActive();
el2.show(0);
return false;
});
el.addEvent('mouseout', function()
{
el.setDeactive();
el2.hide(20);
});
new DropdownMenu(el2);
el.hasSub = 1;
}
});
if (!el.hasSub)
{
el.addEvent('mouseover', function()
{
el.setActive();
return false;
});
el.addEvent('mouseout', function()
{
el.setDeactive();
});
}
}
});
return this;
}
});
Window.onDomReady(function() {new DropdownMenu($E('#cw_menu ul.menu-nav'))});
}else {
sfHover = function() {
var sfEls = document.getElementById("#cw_menu ul.menu-nav").getElementsByTagName("li");
for (var i=0; i<sfEls.length; ++i) {
sfEls[i].onmouseover=function() {
this.className+="sfhover";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp("sfhover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
}
qualche smanettone ci da un'occhiata.grazie
-
smanettone a rapporto! ;D
a prima vista sembra un conflitto di script...
prova ad escludere il jquery e vedi se il menu funziona.
-
ciao
ricdata
già fatto ma nulla da fare non ne vuole sapere.se fosse conflitto ci sarebbe anche in 1.5, i template che vedi sono identici come contenuti di script.
per me è qualcosa che non digerisce 1,6 ho e cambiato qualcosa nella gestione menu .
-
la 1.6 non è proprio uguale alla 1.5
se ci fai caso (io l'ho notato adesso) la 1.6 carica di default ben 4 script, a differenza della 1.5 che ne caricava due. questo senza dubbio complica un pò le cose.
per prima cosa proverei a mettere
<script type="text/javascript" src="/templates/temp1.6/js/moo_topmenu.js"></script>
come primo script, e non dopo il jquery.
altro tentativo che puoi fare è di inserire
jQuery.noConflict();
nella prima riga del file /templates/temp1.6/js/fading.js
e di conseguenza sostituire tutti i "$" presenti all'interno dello stesso file con "jQuery"
-
niente da fare lo script e come se non ci fosse ,
ora se vedi funziona enssa script con solo css. ma l'effetto e diverso .
ma prima ho poi scoprirò del perché.
-
non so se può dipendere da questo, comunque ora vedo che hai caricato due volte (da evitare)
<script type="text/javascript" src="/templates/temp1.6/js/moo_topmenu.js"></script>
e tra l'altro, sempre in quel file non c'è più lo script, ma un misto di html e js, che messo così non può funzionare.
nei file .js deve esserci solo ed esclusivamente js.