Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
vBulletin Drop Downs on Hover (no click required) Details »»
vBulletin Drop Downs on Hover (no click required)
Version: 1.00, by Gio~Logist Gio~Logist is offline
Developer Last Online: Oct 2022 Show Printable Version Email this Page

Category: Mini Mods - Version: 4.2.0 Rating:
Released: 02-19-2013 Last Update: Never Installs: 26
Template Edits
 
No support by the author.

Brought To You By
ModernvB - Vbulletin Solutions & Services
http://www.modernvb.com


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>
$(".popupmenu").hover(
  function () {
    $(this).find( '.popupbody' ).show();
  },
  function () {
    $(this).find( '.popupbody' ).hide();
  }
);
</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 {
top: 21px;
}

Screenshots

File Type: jpg hoverdrop.jpg (52.2 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #32  
Old 04-22-2013, 11:34 PM
CouponWCents CouponWCents is offline
 
Join Date: Jun 2011
Posts: 164
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks so much! WOrks perfectly!!
Reply With Quote
  #33  
Old 04-28-2013, 05:02 PM
Art Andrews Art Andrews is offline
 
Join Date: Jan 2005
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #34  
Old 04-28-2013, 05:49 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #35  
Old 05-14-2013, 05:00 AM
Art Andrews Art Andrews is offline
 
Join Date: Jan 2005
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #36  
Old 05-14-2013, 06:29 PM
bzcomputers's Avatar
bzcomputers bzcomputers is offline
 
Join Date: Apr 2012
Location: TX
Posts: 503
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Art Andrews View Post
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.
Care to share what list you settled on?
Reply With Quote
  #37  
Old 05-15-2013, 08:15 AM
Art Andrews Art Andrews is offline
 
Join Date: Jan 2005
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by bzcomputers View Post
Care to share what list you settled on?
We only wanted the dropdowns we created in the Navigation Manager to work with hover, so those will be unique to every site. Ours all start with "#tab_njmz_" followed by a three digit number. We just added those in and for the time being took everything else out. I might add a few more areas, like the notifications tab at the very top of the page, but in doing this we INSTANTLY stopped a number of usability members were having especially in areas like pagination and the forum search dropdown.
Reply With Quote
Благодарность от:
bzcomputers
  #38  
Old 05-15-2013, 12:07 PM
bzcomputers's Avatar
bzcomputers bzcomputers is offline
 
Join Date: Apr 2012
Location: TX
Posts: 503
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For those of you who may a little more guidance...

Replace this line:
Code:
$(".popupmenu").hover(
With something like this:
Code:
$("#tab_mjk1_938, #tab_mza2_195, #tab_mze1_234, #menu_mdu0_893, #vbmenu_community, #vbmenu_actions, #vbmenu_qlinks, .nonotifications, .notifications").hover(
Be sure to change the items in red to reference to your own specific tabs or menus.

--------------------
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.
Reply With Quote
Благодарность от:
Art Andrews
  #39  
Old 08-15-2013, 02:19 PM
edrecovery edrecovery is offline
 
Join Date: Apr 2012
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there an easier way to do the hovermenu without editing code? I'm not good at editing code.
Reply With Quote
  #40  
Old 01-28-2015, 07:33 PM
kemraj kemraj is offline
 
Join Date: Aug 2014
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #41  
Old 01-28-2015, 10:54 PM
bzcomputers's Avatar
bzcomputers bzcomputers is offline
 
Join Date: Apr 2012
Location: TX
Posts: 503
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kemraj View Post
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.
Is there an alternative to jQuery out there - probably. But most of the options you will find probably involve using jQuery.

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>
OR

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:07 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04814 seconds
  • Memory Usage 2,348KB
  • Queries Executed 28 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_code
  • (1)bbcode_html
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (2)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete