Reply
Relative Layer Height?
Old 12-23-2005, 09:51 AM Relative Layer Height?
ExpressoDan's Avatar
Ultra Talker

Posts: 317
Name: This Space for Rent
Location: Georgia
Trades: 0
I have two layers one on top of the other. The one on the bottom (z index 1) servers as a background and the one on top is the content layer (z index 2) that can expand based on the content. Is there any way to make the height of the background layer (z index 1) grow relative to the layer on top of it (z index 2)?
__________________
Daniel
"I think therefore I am, I think." <!-- George Carlin
ExpressoDan is offline
Reply With Quote
View Public Profile Visit ExpressoDan's homepage!
 
 
When You Register, These Ads Go Away!
Old 12-23-2005, 09:58 AM
amygdela's Avatar
Super Talker

Posts: 111
Trades: 0
nope that just can't be done because they are actually just 2 separate divs. But I wonder why you had to do it like this?
amygdela is offline
Reply With Quote
View Public Profile
 
Old 12-23-2005, 10:03 AM
praveen's Avatar
Life is a Dream

Latest Blog Post:
and a little bit more…
Posts: 3,583
Location: in a distant land far away from reality
Trades: 0
i have used them with div's and not with layers so i dont know if it will work.

here it is.

btw this is not my code.

put this as a js file or have it in the head - ur preference.

Code:
function P7_colH(){ //v1.6 by PVII-www.projectseven.com
 var i,oh,hh,h=0,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){
 for(i=0;i<dA.length;i++){dA[i].style.height='auto';}for(i=0;i<dA.length;i++){
 oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=0;i<dA.length;i++){if(an){
 dA[i].style.height=h+'px';}else{P7_eqA(dA[i].id,dA[i].offsetHeight,h);}}if(an){
 for(i=0;i<dA.length;i++){hh=dA[i].offsetHeight;if(hh>h){
 dA[i].style.height=(h-(hh-h))+'px';}}}else{document.p7eqa=1;}
 document.p7eqth=document.body.offsetHeight;
 document.p7eqtw=document.body.offsetWidth;}
}
function P7_eqT(){ //v1.6 by PVII-www.projectseven.com
 if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth){
 P7_colH();}
}
function P7_equalCols(){ //v1.6 by PVII-www.projectseven.com
 if(document.getElementById){document.p7eqc=new Array;for(var i=0;i<arguments.length;i++){
 document.p7eqc[i]=document.getElementById(arguments[i]);}setInterval("P7_eqT()",10);}
}
function P7_eqA(el,h,ht){ //v1.6 by PVII-www.projectseven.com
 var sp=10,inc=20,nh=h,g=document.getElementById(el),oh=g.offsetHeight,ch=parseInt(g.style.height);
 ch=(ch)?ch:h;var ad=oh-ch,adT=ht-ad;nh+=inc;nh=(nh>adT)?adT:nh;g.style.height=nh+'px';
 oh=g.offsetHeight;if(oh>ht){nh=(ht-(oh-ht));g.style.height=nh+'px';}
 if(nh<adT){setTimeout("P7_eqA('"+el+"',"+nh+","+ht+")",sp);}
}
and in your body tag
Code:
onload="P7_equalCols('id1','id2')">
the layers need to have an id assigned to them.

let know if this works.
__________________
Praveen
Smilies - Celebs - Short URLs - Indian Food - Wild Creek

Useful Threads, Tutorials and Resources
Graphics - Templates - Dreamweaver - Javascript - SEO - Ruby on Rails - Ajax Tutorials - More Ajax - CSS - More CSS
praveen is offline
Reply With Quote
View Public Profile Visit praveen's homepage!
 
Old 12-23-2005, 10:16 AM
funkdaddu's Avatar
Web Design Snob

Posts: 636
Trades: 0
Why not just apply the background to the content div? Also try putting the content div inside the background div and give it 100% width and height.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 12-23-2005, 01:29 PM
ExpressoDan's Avatar
Ultra Talker

Posts: 317
Name: This Space for Rent
Location: Georgia
Trades: 0
Thanks Y'all. I don't have a whole lot of experience with div's for the actual positioning of content on a page (table junkie... I know I know).

praveen,
Thanks for the script, it looks like it does what its supposed to do, but wont work with my scenario...

I think I'm with amygdela on this one, I'm going back to the drawing board to re-evaluate the layout and what the best approach should be.

Thanks to all for pointing me in the right direction
__________________
Daniel
"I think therefore I am, I think." <!-- George Carlin
ExpressoDan is offline
Reply With Quote
View Public Profile Visit ExpressoDan's homepage!
 
Old 12-29-2005, 08:25 AM
amygdela's Avatar
Super Talker

Posts: 111
Trades: 0
Just drop your image from the background-div into the actual background of the overlaying div.

CSS:
Code:
 
#divimage {
background: #FFFFFF url(images/image.jpg) top left repeat-y;
width: 300px;
min-height: 200px;
}
HTML:
Code:
<div id="divimage">
    <p>This is your text on the background, in the div</p>
</div>
But considering the fact that this is just too easy, I bet you reckon something else?
amygdela is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Relative Layer Height?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.13082 seconds with 13 queries