SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Struggling to resize a div dynamically

    Hi,


    I have 2 columns which need to be the same size. The text changes the height of 'content_topBG' and I want 'sideBG' to match it.
    Code:
    function matchHeight(){
    	var bigColumnHeight=document.getElementById('content_topBG').offsetHeight;
    	newHeight=(bigColumnHeight-750);
    	alert(newHeight);		
    	document.getElementById('sideBG').style.height=newHeight;
    	
    }
    As far as I can see, the problem is with the assignment of the value newHeight to the height property of sideBG.

    This is driving me mad. Please help.

    Thanks,
    Andy



    If it helps, the CSS is:

    Code:
    #sideBG {
    	float:left;
    	width:250px;
    	background: #ffffff url(images/sideBG01.jpg) no-repeat top left;
    	/*height:auto;*/
    }
    
    #content_topBG {
    	background: #000000 url('images/characterBG.jpg') top no-repeat;
    	float:right;
    	width: 648px;
    	/*min-height: 550px;*/
    	margin:20px 0 0 0;
    	padding: 10px 0 0 0;
    	border: 1px solid #330000;
    }

  2. #2
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Javascript is not necessary for this.

    I would check out some of Paul O'B's equal height column layouts here:

    - http://www.pmob.co.uk/temp/2colfixedtest_4.htm
    - http://www.pmob.co.uk/temp/2columnce...equalising.htm
    - http://www.pmob.co.uk/temp/2column_simple_1.htm

    Hope that helps.
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  3. #3
    SitePoint Member
    Join Date
    May 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks JimmyP

    I'll look into this.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •