Skip to main content

Error JS en Mega Menu en plantillas bajo JA Purity II en el mouseout

Cuando se está utilizando una platnilla basada en JA Purity II, y se hace el mouseout de un menu desplegable en un Menu Mega se produce un error Javascript:

li.hasClass is not a function
if (li.hasClass ('haschild-over'))

Line 463: if (li.hasClass ('haschild-over'))

La solución para este error es la siguiente:

  • YOURTEMPLATE/libs/menu/base.class.php - find the following lines:- for me it was line 289: comment out this line and replace with the one that has (true) in the brackets:
    //$v->url = JURI::base();
    $v->url = JURI::base(true).'/';
    - for me it was lines 654 and 660 where you simply need to add the word true:
    (line 554) $itembg = 'style="background-image: url('/.JURI::base(true).'/images/stories/'.$iParams->get('menu_image').');"';
    (line 660) $txt = '<span><img src="'.JURI::base(true).'/images/stories/'.$iParams->get('menu_image').'" alt="'.$tmp->name.'" title="'.$tmp->name.'" /></span><span>' . $tmp->name . '</span>';

and the other file you care about is

  • YOURTEMPLATE/js/menu/mega.js- for me it was line 236. Please comment out:
    //if (li.childcontent) li.timer = setTimeout(this.itemHide.bind(this, [li, e]), this.options.delayHide);
    - and replace with this one:
    if (li.childcontent) li.timer = this.itemHide.delay(this.options.delayHide, this, [li, e]);

- - - - - - - - - - - - - - - -

Localizar en templates/PLANTILLA/js/menu/mega.js

línea 236:

if (li.childcontent) li.timer = setTimeout(this.itemHide.bind(this, [li, e]), this.options.delayHide);

Cambiar a esto: (quitar los corchetes de "li, e")

if (li.childcontent) li.timer = setTimeout(this.itemHide.bind(this, li, e), this.options.delayHide);

Hope it helps))
Just noticed it works es expected only in Chrome. In other browsers it doesn't animate when hiding. It seems browsers treat differently the use of square brackets. FF, Opera and others take [li, e] as corresponding arguments for itemHide, while Chrome treats [li, e] as one argument, which causes li.hasClass to fail in itemHide.

| Joomla