Alex Calara wrote:
>
> On Jan 29, 2007, at 5:56 AM, Rob O'Rourke wrote:
>
>> It might be worth re-visiting Shaun's article...
>> The crux of Shaun Inman's clearing script is that it changes the CSS
>> rule for the longest column in an absolutely positioned layout to
>> 'position: relative;'. He does this simply by comparing the heights of
>> his main columns and setting the css rule 'position: relative;' (as
>> opposed to default absolute) on the longest one by switching its
>> class-name. This brings it back into normal document flow so the
>> footer
>> that has no positioning defined (absolute or relative) will be pushed
>> down in the normal way.
>>
>> You would be much better off keeping this approach intact instead of
>> messing around with ems and trying to actually position the footer
>> with
>> javascript directly. You'll be tearing your hair out getting that to
>> work cross-browser.
>>
>
> That sounds reasonable. So I would have to just pull the height out
> with jQuery (not needing the dimensions plugin, since I no longer
> need the offsets)? I am still unsure of how to compare the heights
> once I do get them. I also don't know how to run this both on load
> and on resize (either browser or text). I think I can figure out the
> necessary css manip with jQuery, as I've done that before.
>
> Maybe I should just go off and learn javascript, but unlike jQuery,
> that is not *fun*. I just hate seeing code that A: doesn't make sense
> to me, and B: seems like it could be done sensibly without sticking
> yet another script at the bottom of the page.
>
>
I hear ya,
first grab the elements you are comparing in separate variables, by id
or class, whatever suits you. Then get the height of each and use a
simple if/else statement e.g. if (col1Height>col2Height) {
col1.style('position' : 'relative') } else { col2.style('position' :
'relative') } (or whatever the syntax for jQuery is, i use mootools for
most things atm). Thats just a general statement for comparing them.
Ideally you'd use the use the jQem plugin to reset the column height
variables in the function but regardless of text resizing the longer
column will be likely to remain the longer column so you can probably
get away without it.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/