SitePoint Sponsor

User Tag List

Results 1 to 16 of 16
  1. #1
    SitePoint Enthusiast [Az]'s Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    X_Core not working with Mozilla

    It's probably just me but I'm having difficulties getting the x_core.js app to work in Mozilla. I'm calling it using the following

    Code:
    // set the height of the CSS columns to the max
    function adjustLayout()  
    {  
    	// Get natural heights  
    	var cHeight = xHeight("mainColumn");  
    	var lHeight = xHeight("leftColumn");  
    	var rHeight = xHeight("rightColumn"); 
    	
    	// Find the maximum height  
    	var maxHeight = Math.max(cHeight, Math.max(lHeight, rHeight));  
    	 
    	// Assign maximum height to all columns  
    	xHeight("mainColumn", maxHeight);  
    	xHeight("leftColumn", maxHeight);  
    	xHeight("rightColumn", maxHeight);  
    }
    This code is loaded at the end of the page and all I'm trying to do is ensure that the heights of the 3 columns are the same. It works fine in IE but in Mozilla it only ever identifies the height of the main column and uses that for the left and right columns even if they are larger. It's almost as though having found mainColumn it then doesn't update the selected element.

    I'm not a Javascript guru but I've trawled through the code with alerts and can't seem to identify the problem so any help much appreciated
    HEXUS Webmaster

  2. #2
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,423
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Have you tried to use the built in javascript debuuger that comes with Mozilla to see if it reports an error?

  3. #3
    SitePoint Enthusiast [Az]'s Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I looked at iot but there are no errors showing up
    HEXUS Webmaster

  4. #4
    SitePoint Enthusiast [Az]'s Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Having messed about some more it appears that no matter what div ID you ask xHeight to get, in my instance it always returns the height of the mainColumn div. Even if you remove all the code and just type a one line alert for the height of leftColumn it returns mainColumn

    This is not the case for IE. IE is version 6 and I'm using Firefox 0.8 when I get the issue
    HEXUS Webmaster

  5. #5
    SitePoint Enthusiast [Az]'s Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looking at the DOM inspector in Firefox it would appear that even if the left and right columns are larger than the main column then the offsetHeight property of all 3 is equal to the value of the main column. Therefore the code works fine if the main column is the largest but not if the left or right are larger.

    I've also tested this in Opera and it works fine there.

    I think there might be a bug in Firefox then when getting the offsetHeight value of an element. I'll look on the Firefox forums to see but any help here would be much appreciated
    HEXUS Webmaster

  6. #6
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you'll post a link to your page I might can help you.

    btw, if you'll search you'll see that I've helped people with this same code many times - everyone wants to blame the library when the real problem is their html or their css or just a browser quirk.

    Has noone noticed the rendering change from Moz 1.5 to Moz 1.6?

  7. #7
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,423
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    What does this script do, if I may ask?

  8. #8
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stymiee
    What does this script do, if I may ask?
    It equalizes column heights. Reference this newsletter.

  9. #9
    SitePoint Enthusiast [Az]'s Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not blaming the script (none of my posts did), I believe it may well be with Mozilla Firefox's interpretation of offsetHeight. It could be an issue with the CSS but there's nothing too fancy in it so I can't see why it would be an issue unless the CSS has to be structured in a particular way for the script to work cross-browser.

    I can't post a link as it is on an intranet but I'll try and set up a mini-example so you can have a look.

    I have posted at mozilla (http://forums.mozillazine.org/viewto...=436115#436115) but no luck yet
    HEXUS Webmaster

  10. #10
    SitePoint Enthusiast [Az]'s Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here you go, a cut down version of the page

    http://www.iainmcwhirter.co.uk/xtest.htm

    You can see it working fine in IE but not in Mozilla. Probably something I've done but I can't find out what it might be
    HEXUS Webmaster

  11. #11
    SitePoint Enthusiast [Az]'s Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The gap at the top is for a header bar but it isn't relevant to the issue in case anyone is wondering
    HEXUS Webmaster

  12. #12
    SitePoint Enthusiast [Az]'s Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bump
    HEXUS Webmaster

  13. #13
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Az, I apologize for my attitude in my first post. It was a bad, bad day - I should not have been on the board that day

    I'll look at your page as soon as I can and make some suggestions.

  14. #14
    SitePoint Enthusiast [Az]'s Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, you must be working for the same company as me

    thanks for your help
    HEXUS Webmaster

  15. #15
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have a look at this: Equalized Columns Demo

    It is important to remember that the column containers must contain statically positioned content containers.

    Also, note how the demo separates the HTML, CSS, and Javascript into their own files. Note also that the 'application' javascript is not combined into the X library files, but is in it's own file.

  16. #16
    SitePoint Enthusiast [Az]'s Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the update, I'll have a look. I'm guessing it might be because the central column isn't positioned absolutely whereas the left and right are.

    I would always separate CSS, JS and HTML into separate files, I just posted something quick for testing but thanks for pointing it out

    Quote Originally Posted by MikeFoster
    Have a look at this: Equalized Columns Demo

    It is important to remember that the column containers must contain statically positioned content containers.

    Also, note how the demo separates the HTML, CSS, and Javascript into their own files. Note also that the 'application' javascript is not combined into the X library files, but is in it's own file.
    HEXUS Webmaster


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
  •