E
E
Evgen Nova2015-11-02 13:34:32
css
Evgen Nova, 2015-11-02 13:34:32

Why did the menu on the site start to slow down?

There is a module called "supermenu".
PHP generated - manually, works in html with css + javascript library.
Not so long ago, namely about 2 weeks, problems with the perception of work began, when the menu is opened, there is a delay in opening more than the set one (in javascript - 200ms), when selecting submenu items with the mouse, braking occurs (when moving the mouse to another menu item, its selection occurs after a couple of seconds).
We tried to disable all scripts, except those needed for the menu - the result is the same (even removed all the updates made before the moment of "braking").
Maybe someone faced a similar problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgen Nova, 2015-11-02
@evgen_nova

function make_page()
{
  var ext_menu_left = jQuery('#ext_menu').offset().left;
  var ext_menu_width = 950;     
  jQuery('#ext_menu div.sub').each(function(){
    var colnum = jQuery(this).find('div.column').size();
   		var w = colnum*190;
    if(w>935) w = 935; w+=25;

    jQuery(this).css('width', w+'px');

    var l = jQuery(this).parent().offset().left;

    if(l+w>ext_menu_left+ext_menu_width)
    {
      var dl = (l+w) - (ext_menu_left+ext_menu_width)-14;
      jQuery(this).css('left', '-'+dl+'px');
    }
  });
  
  jQuery("#ext_menu2 > li").mouseenter(function(e)
    {
        if( gDDMTimer != null )
        {
            clearTimeout(gDDMTimer);
            gDDMTimer = null;
            jQuery("#ext_menu li.hover").removeClass("hover");
        }
        
        var li = this;
        
        gDDMTimer = setTimeout( function(e)
        {
            jQuery(li).addClass("hover");
            clearTimeout(gDDMTimer);
            gDDMTimer = null;    
        }, 0);
    });
    jQuery("#ext_menu2 > li").mouseleave(function(e)
    {        
        jQuery("#ext_menu li.hover").removeClass("hover");         
        if(gDDMTimer != null) clearTimeout(gDDMTimer);
        gDDMTimer = null;
    });
}

I
inDeepCode, 2015-11-02
@inDeepCode

Probably because the volume of the HTML document as a whole has increased, and JQ selectors like .find('div.column'), jQuery("#ext_menu2 > li") are starting to slow down wildly.
Solution: Specify your selectors as strictly as possible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question