SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Netherlands
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    give a var some more 'height'

    Hey there,

    I want to add some value (50 px) to rHeight, do you guys know how i can manage this?

    Thanks in forward

    <script type="text/javascript">
    function adjustLayout()
    {
    // Get natural heights
    var cHeight = xHeight("centercontent");
    var lHeight = xHeight("leftcontent");
    var rHeight = xHeight("rightcontent");

    // Find the maximum height
    var maxHeight = Math.max(cHeight, Math.max(lHeight, rHeight));

    // Assign maximum height to all columns
    xHeight("center", maxHeight);
    xHeight("left", maxHeight);
    xHeight("right", maxHeight);

    // Show the footer
    xShow("footer");
    }
    window.onload = function()
    {
    xAddEventListener(window, "resize", adjustLayout, false);
    adjustLayout();
    }
    </script>

  2. #2
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is the problem that the value of rHeight is a non-numeric value because it contains the unit of measurement e.g. "10px" ?
    If that's the case, then this will do the job:

    Step-by-step approach:
    Code:
    var pixVal = rHeight.substring(0,rHeight.length-2);
    var newPixVal = parseInt(pixVal) + 50;
    rHeight = newPixVal+"px";
    All-in-one approach:
    Code:
    rHeight = parseInt(rHeight.substring(0,rHeight.length-2))+50+"px";
    Andy
    From the English nation to a US location.

  3. #3
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Netherlands
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
     xHeight("right", maxHeight+50);
    did the trick

  4. #4
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I had to make some assumptions as I wasn't in posession of all the facts Glad you sorted it.


    Andy
    From the English nation to a US location.


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
  •