Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-16-2009, 03:41 PM
Shelby Shelby is offline
 
Join Date: Nov 2005
Posts: 67
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Navbar Drop Down Menu (3.8 Drop Downs in 4.0) - Need Help.

One thing I really liked in the 3.8 series were the drop down navigation items in the navbar. In 4.0 those don't exist. I'd like reimpliment them and I'm having a bit of trouble and hoping someone can lend a hand.

Here is the plugin code I'm using to add a new navigation item and then give it dropdown capability. However, things don't exactly look right, I'm hoping someone can help me figure out why it doesn't look right.

Code:
global $template_hook;

$template_hook['navtab_end'] .= '

  <li class="popupmenu selected">
                                <a href="javascript://" class="popupctrl" style="background: transparent">Drop Down</a>
                                <ul class="popupbody popuphover">
                                        <li><a href="sublink1.php">SubLink 1</a></li>
                                        <li><a href="sublink2.php">SubLink 2</a></li>
                                        <li><a href="sublink3.php">SubLink 3</a></li>
                                </ul>
                            </li>

' ;
I need to fix two things. Specifically, I need the "Drop Down" item to take on the font styling of navtab, and then for some reason Sublink 1 is indented. Perhaps I need new CSS for this. Any ideas?



Attached Images
File Type: jpg navitem.jpg (66.8 KB, 0 views)
File Type: jpg navitem2.jpg (67.6 KB, 0 views)
Reply With Quote
  #2  
Old 11-16-2009, 04:12 PM
Shadab's Avatar
Shadab Shadab is offline
 
Join Date: Apr 2007
Location: Bhopal
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Shelby.

This works, although only when the tab is in 'selected' state:
HTML Code:
<li class="selected popupmenu">
    <a class="navtab popupctrl" href="javascript://">Drop Down</a>
    <ul class="popupbody popuphover">
        <li><a href="sublink1.php">SubLink 1</a></li>
        <li><a href="sublink2.php">SubLink 2</a></li>
        <li><a href="sublink3.php">SubLink 3</a></li>
    </ul>
</li>



Removing the 'selected' class seems to break the dropdown menu styling. I haven't really looked at all the CSS classes, ids, etc that are used in this new skin (and the new dropdown system); so I could be missing something.
.
Attached Images
File Type: png top-level-dropdown-menu.png (4.2 KB, 0 views)
Reply With Quote
  #3  
Old 11-16-2009, 07:22 PM
Shelby Shelby is offline
 
Join Date: Nov 2005
Posts: 67
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah,

The problem is once I remove the selected state the navtabs lose their background and look funny, but it solves the problem where the navbar item looks like it is selected. I think if this can be worked out a lot of people would like this but I'm running into a roadblock mentally. Bleh.
Reply With Quote
  #4  
Old 11-16-2009, 09:36 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

plugin:
PHP Code:
global $template_hook;
$newTemplate vB_Template::create('dropdown');
$template_hook['navtab_end'] .= $newTemplate->render(); 
template - dropdown:
HTML Code:
<li class="popupmenu">
<a href="javascript://" class="popupctrl navtab" style="background:transparent url({vb:stylevar imgdir_misc}/arrow.png) no-repeat {vb:stylevar right} center; padding-right: 15px">Drop Down</a>
<ul class="popupbody popuphover">
<li><a style="text-indent: 0px; color:{vb:stylevar navbar_selected_popup_body_a_Color}" href="sublink1.php">SubLink 1</a></li>
<li><a style="color:{vb:stylevar navbar_selected_popup_body_a_Color}" href="sublink2.php">SubLink 2</a></li>
<li><a style="color:{vb:stylevar navbar_selected_popup_body_a_Color}" href="sublink3.php">SubLink 3</a></li>
</ul>
</li>
Reply With Quote
  #5  
Old 11-16-2009, 10:41 PM
Shelby Shelby is offline
 
Join Date: Nov 2005
Posts: 67
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Heya Lynne,

Was there a particular reason you did it that way vs a single plugin out of curisoity? I'm not a coder but figured I'd ask, just wondering.

Also, I gave it a whirl Lynne and it seems the same issue exists. The text links for the SubLinks end up white on a white background. And the arrow dissappears when highlighted.

Thanks for the help you two. I'm a bit closer I think to figuring this out.
Reply With Quote
  #6  
Old 11-16-2009, 11:39 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Weird. It worked just fine for me using the method I posted. Check your page source and see if the color:black is showing up in the <a> tag like I have above. Also, check your stylevar "navbar_selected_popup_body_a_Color" and see if it is modified to white instead of black.
Attachment 106223

I did it by using a template so that I could use the stylevars to get the color from the users css instead of saying color:black.
Reply With Quote
  #7  
Old 11-17-2009, 03:10 AM
Shelby Shelby is offline
 
Join Date: Nov 2005
Posts: 67
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Lynne,

You were right, just some settings. Only two things left to fix if anyone else would like to lend a hand.

Specifically, when you mouseover the dropdown, the down arrow dissappears. Secondly, how to change the background color of the li navtab's.
Reply With Quote
  #8  
Old 11-17-2009, 04:20 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

On my forum the arrow doesn't disappear when you mouseover it, so I'm not sure why that is happening for you.

And exactly what background color are you talking about? If you are talking about for all the css, you should download Don's StyleVar Dictionary and look in there for the navtabs stuff.
Reply With Quote
  #9  
Old 11-18-2009, 04:19 AM
Shelby Shelby is offline
 
Join Date: Nov 2005
Posts: 67
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well I worked out the CSS issues, but I noticed a small bug and tested it on a fresh install.

As above, I'm using this as my plugin:

Code:
global $template_hook;
$newTemplate = vB_Template::create('dropdown');
$template_hook['navtab_end'] .= $newTemplate->render();
And this as my template:

Code:
<li class="popupmenu">
<a href="javascript://" class="popupctrl navtab" style="background:transparent url({vb:stylevar imgdir_misc}/arrow.png) no-repeat {vb:stylevar right} center; padding-right: 15px">Drop Down</a>
<ul class="popupbody popuphover">
<li><a style="text-indent: 0px; color:{vb:stylevar navbar_selected_popup_body_a_Color}" href="sublink1.php">SubLink 1</a></li>
<li><a style="color:{vb:stylevar navbar_selected_popup_body_a_Color}" href="sublink2.php">SubLink 2</a></li>
<li><a style="color:{vb:stylevar navbar_selected_popup_body_a_Color}" href="sublink3.php">SubLink 3</a></li>
</ul>
</li>
And it appears to work great. However, there is a negative side effect or bug. Once you turn on the plugin the "Forums" navtab is perminantly selected and the subnavtabs only show the forum options, even while viewing the homepage or CMS, the forums is still selected and the submenu display the options for this.

As you can see in the image, I'm browsing the homepage, but the submenu is showing me on the forums. And the submenu that is supposed to be displayed (highlighted in red) isn't showing up. Note this is only an issue with the CMS for some reason. If you do the "Whats New" link the submenu changes.

Attachment 106341

I've been banging my head against the wall as to this particular problem. For me personally this isn't a big deal because I plan to get rid of the whole second navigation bar entirely, but this might not be a good effect for everyone.

I've determined that regardless of what I put in the template. Even if the template is blank, just turning on the plugin causes the bug. So I've narrowed it down to the plugin.
Reply With Quote
  #10  
Old 11-18-2009, 03:02 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's interferring with the plugin adding the Home tab. Change the hook location for your plugin to process_templates_complete and it will work fine.
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 06:42 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04713 seconds
  • Memory Usage 2,299KB
  • Queries Executed 14 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (2)bbcode_html
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (3)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete