I'm trying to make one div in my page show different contents at different times. I need:
1. Div contents to change "onclick"
2. The wrapper div to expand if the contents expands (which means I need a relative div)
3. The div to stay in the same place no matter what content shows (which means I need an absolute div)
4. Ideally, I'll use a class to define the attributes (position, absolute) and an ID to identify a layer for show/hide layers (which means I need an absolute div)
#2 is causing me grief; I can't get the wrapper to enclose the long contents
There is a Dreamweaver behaviour, "Set text of layer" which looks neat, but it doesn't work for me since I've got 3 nested divs to give me a dynamically resized background box. The background gifs fail if I use this feature on the outer div, and I can't get it to work on the inner div. The outer div is the one I'm manipulating in #1-4 above.
The test code is here at this time (it may come down in the future, for later readers of this post):
http://s179034073.onlinehome.us/suzie/services.htm
Here are my divs:
.left-wrapper {
width: 500px;
margin-left: 25px;
margin-right: 15px;
float: left;
clear: left;
margin-top: -30px;
margin-bottom: 15px;
}
.expandable-box-left { /*outer layer I'm manipulating */
position: relative; /*needs to be absolute to make it a layer, overlap*/
width: 500px;
z-index:9;
background: url(../images/bottom-left.gif) no-repeat left bottom;
visibility: visible;
}
#exec1 { /*id I've named first content div*/
visibility: visible;
position: relative; /*made it relative to enclose it in wrapper*/
}
#exec2 { /*id I've named second content div*/
visibility: hidden;
position: absolute; /*needs to be absolute to overlay exec1*/
}
The HTML:
Rest of the CSS fyi
/*cosmetic background stuff*/
.box-outer {
background: url(../images/bottom-right.gif) no-repeat right bottom;
padding-bottom: 10px;
}
.box-inner {
background: url(../images/top-left.gif) no-repeat left top;
z-index:11;
}
.expandable-box-left h2 {
background: url(../images/top-right.gif) no-repeat right top;
padding-top: 20px;
padding-bottom: 10px;
}
Any ideas are very welcome.
Hi stlauc, would it not be
Hi stlauc,
would it not be easier (and less confusing for the end-user) if you just actually used separate pages?
Also it's confusing to talk
Also it's confusing to talk of layers in CSS. CSS has no concept of "layers" at all.
Dreamweaver tacks this concept on top of CSS, in my opinion confusingly and misleadingly, and it has done much damage in creating brittle, confusing pages that don't work well cross browser.
If you want to design with CSS, learn CSS. Dreamweaver is a fine text editor, but it's "layers" feature is nonsense and should be shunned.
Separate pages work, but if
Separate pages work, but if a common thing changes on 10 pages that are 90% the same, it's hard to update. I'd use DW templates to avoid this, but DW 8 doesn't show my layers properly in templates, so it's not very friendly. I'm using DW library items to mitigate this, but there must be a better way, and a non-DW dependent way. How do you share common content?
You do that with a server
You do that with a server side processing language like PHP or (shudder) .asp, or even Apache's built in "server side includes" methods.
I tend to create a file call
I tend to create a file call nav.inc.php, save it in a folder called "includes" and have
that's all that's in the file... then in your index.php file where I want the menu to parse i use this line of code
<?php include ("includes/nav.inc.php"); ?>
then when you unlease the code onto the web, it automagically™ puts in the navigation
thanks
Love it - thanks
carole