When you mouse-over a menu item to show a minipanel, the CSS "hover" attribute will be active. Often menu items have CSS defined to make them stand-out when being hovered.
If you then go to the minipanel the "hover" attribute is cleared (which is right in a way because you aren't hovering over the menu item anymore). It would be clearer for the enduser if the "hover" attribute would remain active during the use of it's assigned minipanel (and thereby leaving the menuitem highlighted by it's hover CSS).

Comments

digibeetle’s picture

I have also posted my question on the qtip forum as i'm thinking that it might be more qtip related than module code related: http://craigsworks.com/projects/forums/thread-how-to-leave-parent-s-css-...

If i find the answer over there i will also post it here!

kaynen’s picture

Hey,

Let me know if this works for you all. Add it immediately following the "settings['content'] = html;" line. You can change the class to whatever you want it to be by changing the word "on".

var thisTip = $(this);
	settings['api'] = {
         beforeShow: function()
         {
            thisTip.addClass('on');
         },
         beforeHide: function()
         {
            thisTip.removeClass('on');
         }
    };
digibeetle’s picture

Hi kaynenh,

Thank you very much for your reply - it totally works!!!

By reading the code i think i also understand what's happening: the api of qtip is called to add two functions: one which is called before the tip shows which will set an extra class on the parent item. The second does the opposite: when the tip is hidden it also removes the extra class from the parent. By using this class in your CSS file you have total control of the hover looks of the parent item when the qtip is used!

Pretty easy to understand, but if you have no javascript/php knowledge it can be quite a task ;-)

For completeness: you have to add this after line 47 of the menu_minipanels.js file in the js directory.

If you would ask me i would say this can be added to the codebase of menu_minipanels :-)

bmx269’s picture

Thanks for this, and I think this should be default.

Anonymous’s picture

Hello,
This code seems to be really interesting but could you be more specific about the css part please ? I changed the word "on" to "bubble" to make a test but I don't see this class anywhere...

In my css, I use .menu-minipanel-2285:hover ul.primary-links li a.bubble {

But nothing happens.

Thank you.

Adam Wood’s picture

Hi,

Can I second bumanthan's request for more details about the CSS part of this?

I need this to be working otherwise it just doesn't look right.

I use the following CSS for my 'hover' function on my mega-menu;

.menu li a:hover {
...
}

I've tried replacing 'on' with '.menu li a:hover', 'menu li a:hover', 'menu' and 'hover' and none of them do anything.

What do I need to do to get this to work? And do I need to do anything else other than add this snippet to the .js file?

Thanks in advance.

bmx269’s picture

It's the li that has the class. So your CSS would look like this: li.on a{}
So for mine I added that to the active / hover state of the menu item. If you need more specific examples, let me know, and I will share them.

Adam Wood’s picture

Version: 6.x-1.4 » 6.x-1.2
Status: Closed (won't fix) » Active

Hi BMX, thanks for your attention on this.

I completely agree with you that this should be default on future releases of this module!

I've tried this again and I still can't get it to work.

This is the end of my .js file;

settings['content'] = html;
    var thisTip = $(this);
settings['api'] = {
         beforeShow: function()
         {
            thisTip.addClass('on');
         },
         beforeHide: function()
         {
            thisTip.removeClass('on');
         }
    };
    $(this).qtip(settings);
  });

And this is the CSS which I'm using for the menu currently;

.menu li a {
  color:#fff;
  display:block;
  font:tahoma;
  font-weight:normal;
  text-decoration:none;
  padding: 8px 25px 9px 25px;
}
.menu li a:hover {
  color:#000;
  font-weight:normal;
  text-decoration:none;
  background:#f3f3f3;
}

I tried adding 'li.on a {my hover settings}' and that didn't make any difference.

Any help would be great!

Thanks.

bmx269’s picture

Looks like the menu_minipanels.js is incorrect.

The line 47 to the end should look like this:

    settings['content'] = html;
    var thisTip = $(this);
	settings['api'] = {
         beforeShow: function()
         {
            thisTip.addClass('on');
         },
         beforeHide: function()
         {
            thisTip.removeClass('on');
         }
    };    
    $(this).qtip(settings);
  });
};

I am thinking this because you do not have "on" showing up.

Here is what it looks like on a dev site of mine. http://whistler.rjdempsey.com

-Trent

Anonymous’s picture

For me works fine with ul.primary-links li a.on

Adam Wood’s picture

Thanks all, I've fixed it in the end!

I think it was a mixture of the .js and playing with the CSS.

For anybody else who has problems with the CSS on this, this is what I had and then had to change it too;

Old;

.menu li a{
  color:#fff;
  display:block;
  font:tahoma;
  font-weight:normal;
  text-decoration:none;
  padding: 8px 25px 9px 25px;
}
.menu li a:hover{
  color:#000;
  font-weight:normal;
  text-decoration:none;
  background:#f3f3f3;
}

New;

.menu li a{
  color:#fff;
  display:block;
  font:tahoma;
  font-weight:normal;
  text-decoration:none;
  padding: 8px 25px 9px 25px;
}
.menu li a.on{
  color:#000;
  font-weight:normal;
  text-decoration:none;
  background:#f3f3f3;
}
tomlichaj’s picture

Version: 6.x-1.2 » 7.x-1.0-rc1

For Drupal 7 you can add this after line 36

var thisTip = $(this);
settings['api'] = {
beforeShow: function()
{
thisTip.addClass('on');
},
beforeHide: function()
{
thisTip.removeClass('on');
}
};

tomlichaj’s picture

Version: 7.x-1.0-rc1 » 6.x-1.2
digibeetle’s picture

@tomlichaj: Yeah, it could be that the line number is different for D7, but indeed it still is working if you add this code. I have already added it myself and saw it worked. IMHO this could be added to the module by default: if you want to make use of it just add the required CSS code to your CSS file and you're done.

damienmckenna’s picture

Status: Active » Fixed

A few things to consider:

  • I don't believe there's a way to really mimic the 'hover' JS event other than using classes.
  • Different themes have different class structures, though the most common is to add a class "active" to the currently DOM element and then theme to e.g. "ul li a.active".
  • Thanks to #1116990: Give access to qTip callbacks, we now have the qTip callbacks available; I've included an example of how to do this for the Omega theme in the API.txt instructions, but the code will work or be adaptable for other themes depending on your needs. This will be included in the next RC release for both the D6 and D7 branches.

Going to mark this one as 'fixed' due to the above.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

bmx269’s picture

Still can't understand what the issue is with adding this to the module. If it is class naming, then active-trail is more what it should be. Thx

damienmckenna’s picture

Status: Closed (fixed) » Needs review

I'll review this again, I must have overlooked comment #2 above.

damienmckenna’s picture

Another issue with a similar goal but a different implementation: #1304560: Apply hover class to triggering menu link I'll review both of these this weekend and will commit the best option.

damienmckenna’s picture

Status: Needs review » Fixed

I committed patches from #1304560: Apply hover class to triggering menu link, which also resolve this issue. The README.txt file explains the class name to use, and the API.txt file includes example code to use a different class, if needed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jwilson3’s picture

Anyone participating on this issue should definitely update to the latest release candidate and use the qtip-hover class!

It rocks, however, I've just filed a related issue that I'm experiencing on sites where I'm using the qtip-hover.

Please checkout #1425046: Qtip-hover state is sticking. Your feedback is appreciated.

josleow’s picture

Version: 6.x-1.2 » 6.x-1.4
Status: Closed (fixed) » Closed (won't fix)

Menu Minipanels - version 6.x-1.4+0-dev

I looked around in module menu_minipanels that has menu_minipanels.callbacks.js.
The problem is that it does not apply "qtip-hover" css to menu minipanel when tab is hovered or megamenu (with minipanels) is open.

I wonder what could be wrong. I tried other way as instructed in that js file but it still doesnt work. Will appreciate if you could take a look.
thanks

Status: Active » Closed (won't fix)