PDA

View Full Version : "Current" id on menu tabs



slobjones
07-15-2007, 08:52 AM
1) Script Title: Modern Bricks Menu

2) Script URL (on DD): http://www.dynamicdrive.com/style/csslibrary/item/modern-bricks-menu/

3) Describe problem:

How do you set the "current" id so it actually reflects the current tab the viewer has selected?

The author appears to have randomly selected one tab for the "current" id, apparently for display purposes only.

I've seen this with other menu scripts on this site. Never is an explanation included, and users post in vain, asking for an explanation.

Why include a "current" id if you're not going to explain how it works?

slobjones
07-15-2007, 09:09 AM
On reflection, I'm guessing the "current" feature is not meant for use with blogs, but only with sites using static pages exclusively.

With static pages, you can change the "current" tab to reflect the page the viewer is visiting.

Unfortunately, since many of us are using blogs, the "current" feature becomes essentially useless.

I'm sure many of us would welcome a "current" tab system that will work with blogs.

DimX
07-15-2007, 11:21 AM
You need to do server side processing to decide where the id="current" goes.
Although it may be possible to do that with javascript by looping through menu items and comparing their hrefs with current location.

slobjones
07-17-2007, 12:28 AM
You need to do server side processing to decide where the id="current" goes.
Although it may be possible to do that with javascript by looping through menu items and comparing their hrefs with current location.
This appears to be something that's way over my head. But again, many bloggers would be in the same predicament with the Dynamic Forums menu scripts.

ryani210693
08-21-2007, 10:33 PM
To set id=current, all that's needed is some simple knowledge of common sense using scripts and coding.

Below is a snippet of where the original current id is, and what i've done for it!


<div id="modernbricksmenu">
<ul>
<li style="margin-left: 1px"><a href="http://www.dynamicdrive.com" title="Home">Home</a></li>
<li><a href="http://www.dynamicdrive.com/new.htm" title="New">New</a></li>
<li id="current"><a href="http://www.dynamicdrive.com/revised.htm" title="Revised">Revised</a></li>
<li><a href="http://tools.dynamicdrive.com" title="Tools">Tools</a></li>
<li><a href="http://www.dynamicdrive.com/forums/" title="DHTML Forums">Forums</a></li>
</ul>
<form id="myform">
<input type="text" class="textinput" /> <input class="submit" type="submit" value="Find" />
</form>
</div>

As you can see, the id=current is set inbetween the first <li> tag where the revised is situated. So all you need to do is cut the id="current" out of where it currently is from the code on the modern brick page now and paste in line with the <li> tags of where you want...e.g. home. Now below, you can see i have named my own navigation, left the links blank for now (as i am currently creating a site and have no links as of yet), and pasted the id="current" in the "home" line inside the li tags in the same position as before (if that makes sense) Take a look and it should become clear. All i have done is basically used some sense to see where it was, and cut and paste where it was needed.


<div id="modernbricksmenu">
<ul>
<li id="current" style="margin-left: 1px"><a href="" title="Home">Home</a></li>
<li><a href="" title="Services">SERVICES</a></li>
<li><a href="" title="Portfolio">PORTFOLIO</a></li>
<li><a href="" title="About">About</a></li>
<li><a href="" title="Contact">Contact</a></li>
</ul>
</div>

Hope this helps and makes sense, if not, do reply.

Ryan.