making a div id disappear

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
hi guys,

i'm using dw/cs3 for a template driven small site.

the top and bottom nav bars are locked into a template, as well as
center-justified 'home page' links extreme top and bottom
of the page.

the nav bars, and the 'home page' links are each positioned
by unique DIV ID identifiers.

i would like to somehow make the "home page" link
disappear on the actual home page, but since it's
locked into the same template as other pages,
i can't seem to.

is there any kind of scripting i could embed in the template header
that might render the 'home page' link DIV invisible, but only
on the "index.htm" page?

thanks for any suggestions ('m not a javascripter or php guy,
else i might be able to cook 1 up myself!!)


Re: making a div id disappear

Quoted text here. Click to load it

Posting a link to your page is traditional and helpful.

Try adding style=3D"visibility: hidden" to the elements that you want to


Re: making a div id disappear

On Wed, 12 Aug 2009 01:08:42 GMT, ZigZag Life wrote:

Quoted text here. Click to load it

Ick. I wonder what happens when a visitor resizes their text.

Quoted text here. Click to load it

The following mangles the nav menu as you requested, causing the link to
completely disappear on the same page it would point to. I think this is a
bad idea, because the menu changes from page to page (something different
missing on each page, possibly with nav links jumping around as the user
navigates around).

You could add something like <body class="home">, <body class="contact">,
etc. on each of your pages, with markup like this for the navbar (adapt to
match your existing markup, which I can't do, not having seen your URL):

  <li class="home"><a href="index.htm">Home</a></li>
  <li class="prods"><a href="products.htm">Products</a></li>
  <li class="about"><a href="team.htm">Our Company</a></li>
  <li class="contact"><a href="contact.htm">Contact Us!</a></li>

Then you use this CSS:

body.home li.home { visibility:hidden; }
body.prods li.prods { visibility:hidden; }
body.profile li.about { visibility:hidden; } { visibility:hidden; }

Again, I think this is the messy way, because the links disappear/appear on
various pages. Cleaner is to use a preprocessor using, say, PHP with a
class indicating the current page followed by common code to insert (or
not) the <a> link, while the text itself "Home" is always inserted. But if
you're not ready to do PHP I don't know what to suggest.


Re: making a div id disappear

Quoted text here. Click to load it

thanks John.  That's a unique and impressive plot!  I often have thought it
would be nice on vertically-stacked (ie left hand) nav bars, to have the
"current" page show up as a muted BG color behind the link, kind-of ID'ing
to the visitor what page they were on.  This scheme of yours does lend
itself to this protocol nicely.

I did actually try Herbert's suggestion of adding visibility: hidden to the
"home" div box, and it works admirably well.

the one fall-back of the above method, is, not sure if I can un-hook the
BODY attribute from DW's template system.  meaning, making it an "editable


Re: making a div id disappear

Quoted text here. Click to load it

if (location.href.indexOf("home_page")>-1) document.getElementById

Quoted text here. Click to load it

Neredbojias / /

Site Timeline