![]() |
vBulletin Drop Downs on Hover (no click required)
1 Attachment(s)
What is this mod? The standard drop down menus in vBulletin (navbar, etc) require a click in order to view the drop down menus. With this little mod, the drop downs will expand simply by hovering. Ran into this with a client of mine and didn't want to charge them to write a few lines of code, so figured I'd just write it and share it with you all. Included an attachment below in case you're wondering what kind of menus this mod effects. Step 1 Determine whether or not you are calling jquery. If you're not sure you can view the source of your website and search for jquery, or just assume you don't have it. If you don't believe you have it, simply go to the headinclude_bottom template and enter this: Code:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> Step 2 Go to your footer template and insert this at the bottom: Code:
<script> Optional *for some styles only, which have compatibility issues * If you're having issues with the menu showing a bit below the button, add the following at the end of the additional.css template: HTML Code:
.navtabs ul.popupbody { |
Reserved.
|
Going to give this a try after I view all the menu's it effects
|
You can also reference jquery from the default VB install.
../clientscript/jquery |
Quote:
Quote:
|
1 Attachment(s)
Was just about to submit something like this, thanks Gio !
However, adding this gives a space under the parent menu and this makes it hard to then hover over the popup menu, you can do it but you have to move your mouse really fast to catch it, see screen shot below. .Me |
Quote:
|
Quote:
|
I installed this also and really don't have the issue you guys described. Kinda weird it does for some and not for others.
Yes there is a little gap but it doesn't give me problems using the mouse to select any options from the popup. |
Quote:
|
Quote:
Quote:
Quote:
|
Quote:
If you hover, the menu shows but with a space/gab, if you then click the parent the menu redisplays as it should with no gap, so it most likely just an inconsistency with the css. My style just has a slightly bigger nav bar then out of the box, will have a look later anyway... .Me |
1 Attachment(s)
I will re install this now so you can check it for yourself.
Have a look at my site via signature in a couple of mins. I will leave it live until you post back. Regards. *Edit Added SS. |
Quote:
If you're having issues with the menu showing a bit below the button, add the following at the end of the additional.css template: HTML Code:
.navtabs ul.popupbody { |
:), think the drop down is only postioned after the selection of the parent (li), if you click a parent, then move to another parent with a drop down, the drop down will show with out a click of the parent.
No idea why they didnt style the menu to postion (where it should be), then hide it, then display it with a selection or click of the parent. .Me |
Quote:
My site if needed - http://www.platboyonline.com/forum.php Screen Shot - http://gyazo.com/7fc3751d420fb95e9846b449bf80cbad |
Yes that has fixed it now thanks.
|
Quote:
|
Quote:
|
Quote:
|
Works with 4.1.12!
|
Quote:
|
Thanks so much for great mod!
It use well on Frirefox and Chrome! But I try on IE 7, it is wrong! When hover the mouse to menu, child menu didn't place on below parent menu, it has moved to another place. Any one has good idea for this issue? Thanks so much! P.s: I want to fix this, because some people still use old IE version! |
Quote:
Code:
<!--[if lte IE 7]> |
Quote:
https://vborg.vbsupport.ru/external/2013/04/7.jpg another idea? Please! Thanks! |
Your site URL?
|
Quote:
TeamViewer ID: I'm online now! Thanks |
I answer questions in the forum to give back to the community. Assisting you privately does not accomplish that goal. Post your code fragments online, I will be happy to assist you here for "free" and others will be able to learn from the experience. :)
|
I had a conflict with this mod and another custom mod I had which also uses jQuery. This may help some others that may have similar conflicts.
In order to get the two to both work I had to make a couple changes. I needed to add this line below the current script in Step 1: Code:
<script type="text/javascript"> jQuery.noConflict() </script> Then replace all "$" with "jQuery" in Step 2 code to this: Code:
<script type="text/javascript"> |
Quote:
I use the encapsulation method all the time in inline jquery and misbehaving JavaScript, it adds a small amount of overhead, but I sleep well. :) |
Thanks so much! WOrks perfectly!!
|
This is a great addition. However, it has created a problem for a number of the dropdowns, especially on smaller devices like tablets. Is there a way to apply this to certain dropdowns and exclude others?
|
This is the solution I used.
Copied and renamed vbulletin_core.js. Modified popupbody so it handled mouseover and mouseout. Thus it has a delay in closing the dropdown for those that mouseout of the box. Copied default popupbody function, renamed and changed the selector that is being detected. Use this for the accordion menus in the user control panel. You have to modify the user control panel template and replace the popupbody selector with the new selector obviously. For tablets and other touch devices. I do feature detection for "touch" and conditionally load the default vbulletin_core.js or the modified vbulletin_core.js. I also added this piece of javascript from google as a touch screen helper https://developers.google.com/mobile...s/fast_buttons. Solved almost all of that double click annoyance. --- I understand that not everyone can modifiy the javascript so you could just expand this jquery code and add a quick mouseout event with delay (650ms works for me), and accomplish the same thing. Anyway my point is that you can just change the detected selector in the templates that triggers the javascript or jquery. That should solve your problem. Unfortunately, I cannot post the source of the javascript, that would be in violation of vbulletin copyright rules. (At least I think it is...). But if you are going down this route I will try to give you a hand, if you have a question. |
Just a note; I found a much easier way to resolve our issue. If you only want the hover to apply to certain classes or ids, you can just replace .popupmenu in Gio's script with a list (seperated by commas) of the areas you want it to apply to. We found that allowing it apply to the whole site was a nightmare, especially on mobile devices like the iPad. Now we have complete control over what menus are hover-to-open and what menus are click-to-open, with just one slight tweak of the script.
|
Quote:
|
Quote:
|
For those of you who may a little more guidance...
Replace this line: Code:
$(".popupmenu").hover( Code:
$("#tab_mjk1_938, #tab_mza2_195, #tab_mze1_234, #menu_mdu0_893, #vbmenu_community, #vbmenu_actions, #vbmenu_qlinks, .nonotifications, .notifications").hover( -------------------- Edit: I had issues with this change myself. If there were any menus overlapping when activated, this would open up both/all the menus. Had to revert back until I can figure out a solution. |
Is there an easier way to do the hovermenu without editing code? I'm not good at editing code.
|
Can this be done with out using jquery.min.js , i tend not to use it on my front page because of it huge size.
|
Quote:
jQuery is so commonly used these days that many users will already have it cached. Just link to it at the Google hosted library shown above (the most likely place they have it cached from), and be sure to use the latest version. Currently: 1.11.2 (if you want to support Internet Explorer 6,7,8 - recommended) Code:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> 2.1.3 (if you don't care to support IE 6,7,8) Code:
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> I personally place the script right in the "footer" template so jquery is available throughout vBulletin. For additional details this article covers it pretty well: http://encosia.com/3-reasons-why-you...query-for-you/. The article was originally written over 5 years ago, but recently updated just a month ago. |
All times are GMT. The time now is 06:25 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|