The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
I'm trying to hide the navbar menu by replacing it with an active button, when the button is clicked I want the active button to go away and the navbar menu to replace the active button. I figured it would be as simple as using an if statement, but for the life of me I have no idea what sort of if statement to use.
To get it started I have used the standard (if condition equals show), as below: Code:
<!-- nav buttons bar -->
<if condition="$show['menuselectnav a:active']">
<div class="tborder" style="padding:$stylevar[cellspacing]px; border-top-width:0px">
<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
<tr align="center">
<if condition="$show['member']">
<td class="vbmenu_control"><a href="usercp.php$session[sessionurl_q]">$vbphrase[user_cp]</a></td>
</if>
<if condition="$show['registerbutton']">
<td class="vbmenu_control"><a href="register.php$session[sessionurl_q]" rel="nofollow">$vbphrase[register]</a></td>
</if>
$template_hook[navbar_buttons_left]
<td class="vbmenu_control"><a rel="help" href="faq.php$session[sessionurl_q]" accesskey="5">$vbphrase[faq]</a></td>
<if condition="$show['communitylink'] AND $show['popups']">
<td class="vbmenu_control"><a id="community" href="$show[nojs_link]#community" rel="nofollow" accesskey="6">$vbphrase[community]</a> <script type="text/javascript"> vbmenu_register("community"); </script></td>
<else />
<if condition="$show['memberslist']">
<td class="vbmenu_control"><a href="memberlist.php$session[sessionurl_q]">$vbphrase[members_list]</a></td>
</if>
<if condition="$show['quick_links_groups']">
<td class="vbmenu_control"><a href="group.php?$session[sessionurl]">$vbphrase[social_groups]</a></td>
</if>
</if>
<td class="vbmenu_control"><a href="calendar.php$session[sessionurl_q]">$vbphrase[calendar]</a></td>
<if condition="$show['popups']">
<if condition="$show['searchbuttons']">
<if condition="$show['member']">
<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a></td>
<else />
<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getdaily" accesskey="2">$vbphrase[todays_posts]</a></td>
</if>
<td class="vbmenu_control"><a id="navbar_search" href="search.php$session[sessionurl_q]" accesskey="4" rel="nofollow">$vbphrase[search]</a> <if condition="$show['quicksearch']"><script type="text/javascript"> vbmenu_register("navbar_search"); </script></if></td>
</if>
<if condition="$show['member']">
<td class="vbmenu_control"><a id="usercptools" href="$show[nojs_link]#usercptools" accesskey="3">$vbphrase[quick_links]</a> <script type="text/javascript"> vbmenu_register("usercptools"); </script></td>
</if>
<else />
<if condition="$show['searchbuttons']">
<td class="vbmenu_control"><a href="search.php$session[sessionurl_q]" accesskey="4">$vbphrase[search]</a></td>
<if condition="$show['member']">
<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a></td>
<else />
<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getdaily" accesskey="2">$vbphrase[todays_posts]</a></td>
</if>
</if>
<td class="vbmenu_control"><a href="forumdisplay.php?$session[sessionurl]do=markread" rel="nofollow">$vbphrase[mark_forums_read]</a></td>
<if condition="$show['member']">
<td class="vbmenu_control"><a href="#" onclick="window.open('misc.php?$session[sessionurl]do=buddylist&focus=1','buddylist','statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=250,height=300'); return false;">$vbphrase[open_contacts]</a></td>
</if>
</if>
$template_hook[navbar_buttons_right]
<if condition="$show['member']">
<td class="vbmenu_control"><a href="login.php?$session[sessionurl]do=logout&logouthash=$bbuserinfo[logouthash]" onclick="return log_out('$vbphrase[sure_you_want_to_log_out]')">$vbphrase[log_out]</a></td>
</if>
</tr>
</table>
</div>
<else>
<div class="menuselectnav"></div>
</if>
<!-- / nav buttons bar -->
This is the css for the menuselectnav button Code:
.menuselectnav {
list-style: none;
margin-left: auto;
margin-right: auto;
padding: 0;
overflow: hidden;
}
.menuselectnav {
width: 100px;
height: 30px;
}
.menuselectnav a {
display: inline-block;
padding: 0px;
background-image: url(images/skins/cyclone/buttons/button_menuselect.gif);
background-position:right top;
background-repeat:no-repeat;
width: 100px;
height: 30px;
}
.menuselectnav a:hover,
.menuselectnav a:focus,
.menuselectnav a:active {
background-image: url(images/skins/cyclone/buttons/button_menuselect.gif);
background-position:left top;
background-repeat:no-repeat;
}
--------------- Added [DATE]1246088101[/DATE] at [TIME]1246088101[/TIME] --------------- |
|
#2
|
|||
|
|||
|
No one has any ideas!
|
|
#3
|
||||
|
||||
|
$show is a variable that gets defined in the code. I am guessing that $show['menuselectnav a:active'] was never defined (and I wouldn't use a variable name like that either). Basically your condition is not a valid one (which you already figured out). When someone clicks on the link, are they going to a new page? If so, you can use THIS_SCRIPT in the condition.
|
|
#4
|
|||
|
|||
|
No, a new page is not to load up, it's a little difficult for me to explain, perhaps the best thing is to show you the function working on a live site:
http://ggweb-fr.com/phpbbfre/ If you scrolldown to the very bottom of the forum and look to the right you will see a small graphic with a green arrow and the copyright symbol to the right of it, click that button, you will see the sites copyright appear below. I would like to achieve something like that, except, I would like a three phase effect, the default button would need to look like this: Attachment 101223 then when one loses over the button it is to look like this: Attachment 101224 then when one clicks the button it looks like this: Attachment 101225 |
|
#5
|
||||
|
||||
|
If you look at the source code for the page, you'll see they are just using javascript for that. You can probably get the script name in the code there.
|
|
#6
|
|||
|
|||
|
Wow, javascript is horrible, I can't quite get it right, this is what I'm doing:
In the header I have this: Code:
<div id="wrap">
<!-- logo -->
<a name="top"></a>
<div id="logo_block">
<div id="logonav"><a href="$vboptions[forumhome].php$session[sessionurl_q]" title="$vboptions[bbtitle]"></a></div>
</div>
<div id="border_block">
<div id="borderleft">
<div id="borderright">
<div id="content_main" class="bodyfill">
<!-- content table -->
$spacer_open
$_phpinclude_output
$ad_location[ad_header_end]
<!-- nav buttons bar -->
<div style="text-align:center">
<a href="#" onclick="dom_toggle.toggle('menu_display', 'menu_open_close', 'images/skins/cyclone/buttons/button_menu_open.gif', 'images/skins/cyclone/buttons/button_menu_close.gif'); return false;"><img src="images/skins/cyclone/buttons/button_menu_open.gif" class="menutoggle" id="menu_open_close" alt="" /></a>
<div class="tborder" style="padding:$stylevar[cellspacing]px; border-top-width:0px">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr align="center">
<if condition="$show['member']">
<td class="vbmenu_control"><a href="usercp.php$session[sessionurl_q]">$vbphrase[user_cp]</a></td>
</if>
<if condition="$show['registerbutton']">
<td class="vbmenu_control"><a href="register.php$session[sessionurl_q]" rel="nofollow">$vbphrase[register]</a></td>
</if>
$template_hook[navbar_buttons_left]
<td class="vbmenu_control"><a rel="help" href="faq.php$session[sessionurl_q]" accesskey="5">$vbphrase[faq]</a></td>
<if condition="$show['communitylink'] AND $show['popups']">
<td class="vbmenu_control"><a id="community" href="$show[nojs_link]#community" rel="nofollow" accesskey="6">$vbphrase[community]</a> <script type="text/javascript"> vbmenu_register("community"); </script></td>
<else />
<if condition="$show['memberslist']">
<td class="vbmenu_control"><a href="memberlist.php$session[sessionurl_q]">$vbphrase[members_list]</a></td>
</if>
<if condition="$show['quick_links_groups']">
<td class="vbmenu_control"><a href="group.php?$session[sessionurl]">$vbphrase[social_groups]</a></td>
</if>
</if>
<td class="vbmenu_control"><a href="calendar.php$session[sessionurl_q]">$vbphrase[calendar]</a></td>
<if condition="$show['popups']">
<if condition="$show['searchbuttons']">
<if condition="$show['member']">
<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a></td>
<else />
<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getdaily" accesskey="2">$vbphrase[todays_posts]</a></td>
</if>
<td class="vbmenu_control"><a id="navbar_search" href="search.php$session[sessionurl_q]" accesskey="4" rel="nofollow">$vbphrase[search]</a> <if condition="$show['quicksearch']"><script type="text/javascript"> vbmenu_register("navbar_search"); </script></if></td>
</if>
<if condition="$show['member']">
<td class="vbmenu_control"><a id="usercptools" href="$show[nojs_link]#usercptools" accesskey="3">$vbphrase[quick_links]</a> <script type="text/javascript"> vbmenu_register("usercptools"); </script></td>
</if>
<else />
<if condition="$show['searchbuttons']">
<td class="vbmenu_control"><a href="search.php$session[sessionurl_q]" accesskey="4">$vbphrase[search]</a></td>
<if condition="$show['member']">
<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a></td>
<else />
<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getdaily" accesskey="2">$vbphrase[todays_posts]</a></td>
</if>
</if>
<td class="vbmenu_control"><a href="forumdisplay.php?$session[sessionurl]do=markread" rel="nofollow">$vbphrase[mark_forums_read]</a></td>
<if condition="$show['member']">
<td class="vbmenu_control"><a href="#" onclick="window.open('misc.php?$session[sessionurl]do=buddylist&focus=1','buddylist','statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=250,height=300'); return false;">$vbphrase[open_contacts]</a></td>
</if>
</if>
$template_hook[navbar_buttons_right]
<if condition="$show['member']">
<td class="vbmenu_control"><a href="login.php?$session[sessionurl]do=logout&logouthash=$bbuserinfo[logouthash]" onclick="return log_out('$vbphrase[sure_you_want_to_log_out]')">$vbphrase[log_out]</a></td>
</if>
</tr>
</table>
</div>
</div>
<!-- / nav buttons bar -->
Code:
<script type="text/javascript" src="$stylevar[imgdir_misc]/js_dom_toggle.js"></script> Code:
function _dom_toggle()
{
return this;
}
_dom_toggle.prototype.objref = function(id)
{
return document.getElementById ? document.getElementById(id) : (document.all ? document.all[id] : (document.layers ? document.layers[id] : null));
}
_dom_toggle.prototype.cancel_event = function()
{
if ( window.event )
{
window.event.cancelBubble = true;
}
}
_dom_toggle.prototype.toggle = function(id, open_close_id, open_icon, close_icon)
{
var object = this.objref(id);
var icon = this.objref(open_close_id);
if ( object && object.style )
{
object.style.display = (object.style.display == 'none') ? '' : 'none';
if ( icon && icon.src )
{
icon.src = (object.style.display == 'none') ? open_icon : close_icon;
}
}
this.cancel_event();
}
// instantiate
dom_toggle = new _dom_toggle();
Code:
.menutoggle {
margin: 0;
padding: 0;
border:0px;
width: 200px;
height: 30px;
}
.menutoggle a:hover {
background: url(images/skins/cyclone/buttons/button_menu_impel.gif);
margin: 0;
padding: 0;
border:0px;
width: 200px;
height: 30px;
}
Any ideas on what I have got wrong? |
|
#7
|
|||
|
|||
|
It's too weird huh, I understand, I do not wish to seem a stress head or anything but for my own sanity, should I consider that no-one knows the solution and move on?
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|