473,382 Members | 1,247 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

nested tabs

Ok, this might be for a web designing group, but here's my problem. I'm
trying to make a web page with tabs which you can navigate between
without the page reloading. I have one set of tabs working great, but
when I add nested tabs there is a problem with the 'visibility' not
being inherited and some parts stay visible in the sub-tabs. Sorry if
this is unclear.

Here's how I have it layed out: I have a <span> for each content
section of a tab. Then I have do the same thing for the content of each
inner tab. When a tab is pressed some javascript code goes through and
makes all content sections hidden and the content section for the tab
that was pressed visible. If I select a tab and then select an inner
tab it looks like is should, but when I try and select a different tab
for the outer tabs the content for the inner section doesn't go away.
I've found that this is because visibility is not inherited. My
question is if anyone has a solution for this problem. I'm sure there
is somebody that knows of some javascript trickery to do this. Thanks
in advance.

-----Horndude77

Jul 23 '05 #1
5 2795
Zif
ho********@gmail.com wrote:
Ok, this might be for a web designing group, but here's my problem. I'm
trying to make a web page with tabs which you can navigate between
without the page reloading. I have one set of tabs working great, but
when I add nested tabs there is a problem with the 'visibility' not
being inherited and some parts stay visible in the sub-tabs. Sorry if
this is unclear.
Gazing into her crystal ball, she cackled "Ah! There's the problem!!"

Here's how I have it layed out: I have a <span> for each content
section of a tab. Then I have do the same thing for the content of each
inner tab. When a tab is pressed some javascript code goes through and
makes all content sections hidden and the content section for the tab
that was pressed visible. If I select a tab and then select an inner
tab it looks like is should, but when I try and select a different tab
for the outer tabs the content for the inner section doesn't go away.
I've found that this is because visibility is not inherited. My
question is if anyone has a solution for this problem. I'm sure there
is somebody that knows of some javascript trickery to do this. Thanks
in advance.


Try:

comp.infosystems.www.authoring.html

but likely you will get no help there either unless you give them
something to look at - link? code?

Preferably a minimal example that displays the relevant behaviour.

--
Zif
Jul 23 '05 #2
Ok someone responded to me without it being posted here that solved my
problem fine. Using 'display:none' instead of messing around with
visibility did it. Here it is (thanks):

If I understand correctly, you can fix this by changing the JavaScript
or changing the CSS.

CSS: Use 'display: none' instead of 'visibility: hidden'. display isn't
'inherited' per se, but it sort of works that way. If you set an
element's display = 'none' you also cause all of its descendant
elements to disappear. Much as if you had a cup of milk and took the
cup away, the milk would go with. If you just make the cup invisible,
it looks like you have floating milk.

The 'problem' with this is that when display is set to none, the space
for it is no longer reserved on the page. By setting something to
invisible, it still takes up space. It's still there. display won't do
that. This is more often useful than obstructive.

JS: Loop through every descendant element and set its visibility to
'hidden'. This is ugly and can cause problems related to the z-index of
the elements. i.e. If an element is supposed to be on top of other
elements and you make it invisible, it will still be there. If it
covers a link, the link will not (normally) be clickable. Also, what if
some of the elements are supposed to be hidden? When you loop through
and make them all visible, they all become visible.

Jul 23 '05 #3
Zif
ho********@gmail.com wrote:
Ok someone responded to me without it being posted here that solved my
problem fine. Using 'display:none' instead of messing around with
visibility did it. Here it is (thanks):
If you change the visibility of an element's parent to 'hidden', then
the element will also be hidden.

<p style="visibility: hidden;"><span>can't see me</span></p>

Why this did not occur for you is a mystery since you didn't post any
examples of where you set an element's visibility to hidden yet the
children continued to be visible.

Since you said you were using 'span' elements to wrap other elements,
it is likely you had invalid HTML and your browser made a guess at what
you wanted and displayed something that was not what you wanted.

'span' is an in-line element and may only contain other in-line
elements. But even so, invalid HTML like:

<span style="visibility: hidden;">
<table><tr><td>can't see me</td></tr></table>
</span>

still results in an invisible table in Firefox and IE.

If I understand correctly, you can fix this by changing the JavaScript
or changing the CSS.
Using JavaScript to change the properties of the elements, yes. You
can do that by changing the style rule or the element's style object
directly.

CSS: Use 'display: none' instead of 'visibility: hidden'. display isn't
'inherited' per se, but it sort of works that way. If you set an
element's display = 'none' you also cause all of its descendant
elements to disappear. Much as if you had a cup of milk and took the
cup away, the milk would go with. If you just make the cup invisible,
it looks like you have floating milk.
Changing an element's visibility to 'hidden' will also hide its
children. Your milk will still be there but you can't see it.

The 'problem' with this is that when display is set to none, the space
for it is no longer reserved on the page. By setting something to
invisible, it still takes up space. It's still there. display won't do
that. This is more often useful than obstructive.
A moot point: a DHTML menu author may have a different opinion.

JS: Loop through every descendant element and set its visibility to
'hidden'. This is ugly and can cause problems related to the z-index of
the elements. i.e. If an element is supposed to be on top of other
elements and you make it invisible, it will still be there. If it
covers a link, the link will not (normally) be clickable. Also, what if
some of the elements are supposed to be hidden? When you loop through
and make them all visible, they all become visible.


But there is no requirement to loop through them all. If elements are
properly nested, changing the visibility of the parent to 'hidden' will
hide the nested elements.

You seem to have some misunderstanding of styles and how they work in
relation to HTML, hence the suggestion that you ask your question in
c.i.w.a.html.
--
Zif
Jul 23 '05 #4
Zif wrote:
ho********@gmail.com wrote:
Ok someone responded to me without it being posted here that solved my
problem fine. Using 'display:none' instead of messing around with
visibility did it. Here it is (thanks):
If you change the visibility of an element's parent to 'hidden', then
the element will also be hidden.

<p style="visibility: hidden;"><span>can't see me</span></p>


Not necessarily. The default value for CSS visibility is 'inherit', but
if it's explicitly set to something else, it will override the
containing element's rule in the cascade:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/str*ict.dtd">
<html>
<style type="text/css">
p { visibility:hidden; }
span { visibility:visible; }
</style>
<head>
</head>
<body>
<p>
<strong>can't see me</strong>
<span>Yes I can...</span>
</p>
</body>
</html>

(snip)
Changing an element's visibility to 'hidden' will also hide its
children. Your milk will still be there but you can't see it.


Again, not necessarily.

(snip)

Jul 23 '05 #5
Zif
RobB wrote:
Zif wrote: [...]
If you change the visibility of an element's parent to 'hidden', then
the element will also be hidden.


[...]
Not necessarily. The default value for CSS visibility is 'inherit', but
if it's explicitly set to something else, it will override the
containing element's rule in the cascade:

[...]
Changing an element's visibility to 'hidden' will also hide its
children. Your milk will still be there but you can't see it.

Again, not necessarily.


As I said, not suitable for a JS group (at least, not my feeble CSS
skills anyhow) ;-)

Had an example been provided by the OP, whether or not that is the
actual issue could have been decided more quickly.
--
Zif
Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: raoul | last post by:
I can't figure this one out. Trying to be unnecessarily functional I suspect. I have the following lists. vals = tab = I'm trying to create a one liner using map/reduce/lambda/zip(* etc...
135
by: Xah Lee | last post by:
Tabs versus Spaces in Source Code Xah Lee, 2006-05-13 In coding a computer program, there's often the choices of tabs or spaces for code indentation. There is a large amount of confusion about...
7
by: kagard | last post by:
Greetings: I'm brand new to Python and decided to write a syllogism solver for a class I'm taking. At the start of the program, I define a function that classifies the type of each statement in...
3
by: Moses | last post by:
Hi I have a nested function which works properly but I need to have a slight change in it where I could not do that Any help plz. The Original function function addSquares(b)
8
AccessIdiot
by: AccessIdiot | last post by:
I'm having some trouble going from one form to another and carrying over the ID field (see this thread if you are interested). So I was thinking about ways around the problem. As far as my very...
1
by: Henrik Bechmann | last post by:
All, I'm trying to spoof Google's vertical tabs in a vertical menu structured with nested UL/LI elements. To do this, I need to find out where the anchor in the LI is, and then create an...
2
by: Wolfgang | last post by:
Hi, I'm trying to understand how could I inherit a nested class. Say for instance - I've four classes namely class A, class B, class C, class D. class B is nested inside class A class D is...
2
by: angi35 | last post by:
I hope this is an easy question for someone out there. In Access 2000…I have a MainForm with a tab control (MAIN TABS) with 7 tabs. Within each tab is a SubForm. Within each SubForm is a tab...
13
by: JRough | last post by:
I got lost on formatting the nested if/else's on the bottom of the file right up the last else/if there seems to be a stray bracket. I'm trying to line up the brackets so I can read it. Is it...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.