Compojoom SlickMenu (IceTheme IceMenu)
Есть JS скрипт Compojoom SlickMenu (он же IceTheme IceMenu). Он входит в любой шаблон от IceTheme для Joomla 1.5 и его можно найти здесь \modules\mod_ice_menu\js.
В IE8,9, Chrome - работает великолепно на любых ПК. В Opera, Firefox - на слабых ПК или нетбуках тормозит безбожно. Особенно заметно тормозит в Опере SlickMenu.dropdown=function(). На Atom'ном нетбуке с Оперой пользоваться менюшкой просто невозможно. Я обращался на форум Compojoom, ответили "I'm not supporting the code anymore. I would advise you to search for another slick menu - from joomlart or rocketthem." Очень не хочется переделывать весь шаблон наново. Помогите кто может!!! <?php /* * Copyright(C) Compojoom.com. All rights reserved. * License [url]http://www.gnu.org/copyleft/gpl.html[/url] GNU/GPL, see LICENSE.php * * !SlickMenu is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * !SlickMenu is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ header('Content-type: text/javascript'); $id = (int)$_GET['id']; if (!$id) { echo "alert('No ID provided!!!');"; exit; } $js = ''; ob_start(); ?> /* * Copyright(C) Compojoom.com. All rights reserved. * License [url]http://www.gnu.org/copyleft/gpl.html[/url] GNU/GPL, see LICENSE.php */ var SlickMenu<?php echo $id; ?>={}; SlickMenu<?php echo $id; ?>.accordion=function(){ function slider(n){this.n=n; this.a=[];} slider.prototype.init=function(t,e,sec,m,o,k){ var a=$(t), i=s=0, n=a.childNodes, l=n.length; this.s=k||0; this.m=m||0; for(i;i<l;i++){ var v=n[i]; if(v.nodeType!=3){ this.a[s]={}; this.a[s].h=h=$(v).getElements(e)[0]; this.a[s].c=c=$(v).getElements(sec)[0]; var trg = $(h).getElement('span.accArrow'); if (SLICKMENU_ACC_EVENT<?php echo $id; ?> == 'mouseover') { $(h).addEvents({ 'mouseover' : new Function('event', 'event = new Event(event); event.stop();' + this.n+'.pr(0,'+s+')') }); } else { if (trg) { $(trg).addEvents({ 'click' : new Function('event', 'event = new Event(event); event.stop(); ' + this.n+'.pr(0,'+s+')') }); } } if(o==s){ $(h).addClass('oppened'); if(c){ c.style.height='auto'; c.style.visibility='visible'; c.d=1; } }else{ if(c){ c.style.height=0; c.style.visibility='hidden'; c.d=-1; } } s++; } } this.l=s; }; slider.prototype.pr=function(f,d){ for(var i=0;i<this.l;i++){ var h=this.a[i].h, c=this.a[i].c; if (c) { var k=c.style.height; k=k=='auto' ? 1:parseInt(k); clearInterval(c.t); if((k!=1&&c.d==-1)&&(f==1||i==d)){ c.style.height=''; c.m=c.offsetHeight; c.style.height=k+'px'; c.d=1; $(h).addClass('oppened'); c.style.visibility='visible'; } else if(k>0&&(f==-1||this.m||i==d)){ c.d=-1; $(h).removeClass('oppened'); } su(c); } } }; function su(c){ if (!SLICKMENU_ACC_ALLOW_ANIM<?php echo $id; ?>) { if (c.d == 1) {c.style.height='auto';} else {c.style.height='0px';} } else { c.t=setInterval(function(){sl(c)},SLICKMENU_ACC_ANIM_SPEED<?php echo $id; ?>); } }; function sl(c){ var h=c.offsetHeight, d=c.d==1?c.m-h:h; c.style.height=h+(Math.ceil(d/5)*c.d)+'px'; if (SLICKMENU_ACC_ALLOW_OPACITY<?php echo $id; ?>) {c.style.opacity=h/c.m; c.style.filter='alpha(opacity='+h*100/c.m+')';} if((c.d==1&&h>=c.m)||(c.d!=1&&h==1)){if(c.d==1){c.style.height='auto'} else {c.style.visibility='hidden';} clearInterval(c.t);} }; return{slider:slider}; }(); SlickMenu<?php echo $id; ?>.dropdown=function(){ var z=50,s=6,a; function dd(n){this.n=n; this.h=[]; this.c=[];}; dd.prototype.init=function(p,c) { a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0; for(i;i<l;i++){ var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i]; $(h).addEvents({ 'mouseover': new Function('event', 'event = new Event(event); ' + this.n+'.st('+i+',true);'), 'mouseout': new Function('event', 'event = new Event(event); ' + this.n+'.st('+i+');') }); }; }; dd.prototype.st=function(x,f){ var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0]; clearInterval(c.t); c.style.overflow='hidden'; if(f){ $(p).addClass(a); c.style.display='block'; if(!c.mh){ c.mh=c.offsetHeight; if (SLICKMENU_DROP_ALLOW_HEIGHT<?php echo $id; ?>){ c.style.height=0; } } if(!c.mw){ c.mw=c.offsetWidth; if (SLICKMENU_DROP_ALLOW_WIDTH<?php echo $id; ?>){ c.style.width=0; } } if(c.mh==c.offsetHeight && c.mw==c.offsetWidth){ c.style.overflow='visible'; } else { c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1);},SLICKMENU_DROP_ANIM_SPEED<?php echo $id; ?>); } } else { $(p).removeClass(a); c.t=setInterval(function(){sl(c,-1);},SLICKMENU_DROP_ANIM_SPEED<?php echo $id; ?>); } }; function sl(c,f){ var h=c.offsetHeight, w=c.offsetWidth, tostop = false; var pt = $(c).getStyle('paddingTop').toInt(); var pb = $(c).getStyle('paddingBottom').toInt(); if (pt || pb) h = h + ((pt + pb) * f); var pl = $(c).getStyle('paddingLeft').toInt(); var pr = $(c).getStyle('paddingRight').toInt(); if (pl || pr) w = w + ((pl + pr) * f); if (SLICKMENU_DROP_ALLOW_HEIGHT<?php echo $id; ?> && SLICKMENU_DROP_ALLOW_WIDTH<?php echo $id; ?>) { tostop=(((h<=0&&f!=1)||(h>=c.mh&&f==1))&&((w<=0&&f!=1)||(w>=c.mw&&f==1))); } else if (SLICKMENU_DROP_ALLOW_HEIGHT<?php echo $id; ?>) { tostop=((h<=0&&f!=1)||(h>=c.mh&&f==1)); } else if (SLICKMENU_DROP_ALLOW_WIDTH<?php echo $id; ?>) { tostop=((w<=0&&f!=1)||(w>=c.mw&&f==1)); } if (tostop){ if(f==1){ if (SLICKMENU_DROP_ALLOW_OPACITY<?php echo $id; ?>) { c.style.filter=''; c.style.opacity=1; } c.style.overflow='visible'; } else { c.style.display='none'; } clearInterval(c.t); return; } var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s); var dw=(f==1)?Math.ceil((c.mw-w)/s):Math.ceil(w/s); var o = 1; if (SLICKMENU_DROP_ALLOW_HEIGHT<?php echo $id; ?>) { o=h/c.mh; } else if (SLICKMENU_DROP_ALLOW_WIDTH<?php echo $id; ?>) { o=w/c.mw; } if (SLICKMENU_DROP_ALLOW_OPACITY<?php echo $id; ?>) { c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')'; } if (SLICKMENU_DROP_ALLOW_HEIGHT<?php echo $id; ?>){ if ((h<=0&&f!=1)||(h>=c.mh&&f==1)) { c.style.height=c.mh+'px'; } else { c.style.height=h+(d*f)+'px'; } } if (SLICKMENU_DROP_ALLOW_WIDTH<?php echo $id; ?>){ if ((w<=0&&f!=1)||(w>=c.mw&&f==1)) { c.style.height=c.mh+'px'; } else { c.style.width=w+(dw*f)+'px'; } } if(!(SLICKMENU_DROP_ALLOW_HEIGHT<?php echo $id; ?> || SLICKMENU_DROP_ALLOW_WIDTH<?php echo $id; ?>)) { c.style.display='none'; } }; return{dd:dd}; }(); <?php $js = ob_get_contents(); ob_end_clean(); $js = preg_replace('/[\n\t]/', '', $js); echo preg_replace('/\s{2,}/', ' ', $js); ?> |
Часовой пояс GMT +3, время: 17:29. |