Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > making a div id disappear

Reply
Thread Tools

making a div id disappear

 
 
ZigZag Life
Guest
Posts: n/a
 
      08-12-2009
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!!)

Gzag


 
Reply With Quote
 
 
 
 
Herbert Blenner
Guest
Posts: n/a
 
      08-12-2009
On Aug 11, 9:08*pm, "ZigZag Life" <(E-Mail Removed)> wrote:
> 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!!)
>
> Gzag


Posting a link to your page is traditional and helpful.

Try adding style="visibility: hidden" to the elements that you want to
hide.

Herbert
 
Reply With Quote
 
 
 
 
John Hosking
Guest
Posts: n/a
 
      08-12-2009
On Wed, 12 Aug 2009 01:08:42 GMT, ZigZag Life wrote:

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


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

>
> 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!!)
>


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):

<ul>
<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>
</ul>

Then you use this CSS:

body.home li.home { visibility:hidden; }
body.prods li.prods { visibility:hidden; }
body.profile li.about { visibility:hidden; }
body.contact li.contact { 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.


--
John
 
Reply With Quote
 
Neredbojias
Guest
Posts: n/a
 
      08-12-2009
On 11 Aug 2009, "ZigZag Life" <(E-Mail Removed)> wrote:

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


if (location.href.indexOf("home_page")>-1) document.getElementById
("home_page_link_id").style.visibility="hidden" ;

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




--
Neredbojias
http://www.neredbojias.org/
http://www.neredbojias.net/
 
Reply With Quote
 
ZigZag Life
Guest
Posts: n/a
 
      08-13-2009
"John Hosking" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Wed, 12 Aug 2009 01:08:42 GMT, ZigZag Life wrote:
>
>>
>> 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.

>
> Ick. I wonder what happens when a visitor resizes their text.
>
>>
>> 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!!)
>>

>
> 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):
>
> <ul>
> <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>
> </ul>
>
> Then you use this CSS:
>
> body.home li.home { visibility:hidden; }
> body.prods li.prods { visibility:hidden; }
> body.profile li.about { visibility:hidden; }
> body.contact li.contact { 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.
>
>
> --
> John


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
region"

ZZL


 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
<div ... /> and <div ...></div> K Viltersten ASP .Net 4 03-31-2009 07:33 PM
Tkinter: Making a window disappear Claus Tondering Python 4 10-10-2006 08:42 AM
Outlook Express Messages Disappear, Bookmarks in Internet Explorer Disappear rchrdcarlisle@NOTyahoo.com Computer Support 19 07-30-2006 09:41 PM
NS/FF don't change div offsetWidth when div innerHTML is added toand div becomes wider mscir Javascript 3 06-26-2005 04:04 PM
Q: Div A inside Div B is larger than Div B Dwayne Madsen Javascript 1 06-01-2005 03:02 PM



Advertisments