largo6 — 2012-01-25T15:43:50-05:00 — #1
my site is in this address: z-ls DOT info
it's a wordpress site.
a added this jquery code to cause the post content (c2) and the widget(widget) to be in the same height,
but it doesn't move, something cause it to stuck at this point
var colHeight = Math.max($('#c2').height(), $('.widget').height());
a line before the last one i tryed:
$('.widget').height() = colHeight + 50;
what is wrong ?
chris_upjohn — 2012-01-25T20:47:19-05:00 — #2
WordPress comes with jQuery pre-enabled so you don't need to request the source for it again, also you will need to use jQuery instead of $ as by default WordPress forces the jQuery.noConflict() method to avoid library conflicts.
largo6 — 2012-01-26T01:56:35-05:00 — #3
thanks for your reply.
i know it's enabled only if i use wp_enqueue_script function.
any way i sayed to myself let's try it and ...
the samething no change
sdleihssirhc — 2012-01-26T02:33:32-05:00 — #4
I tried just the code you posted, and it seemed to work fine. Can you link to a live example? Can somebody please help me with my reading comprehension?
largo6 — 2012-01-26T02:34:44-05:00 — #5
the bottom near the footer
sdleihssirhc — 2012-01-26T02:44:35-05:00 — #6
Found the problem:
The #c2 element has 1507px height, a 30px bottom padding, and a 10px bottom border.
The .widget element has 1507px height, a 10px top padding, a 10px bottom padding, and a 10px bottom border.
After you add everything up, the #c2 element is 10px taller than the .widget element, even though they both have a height of 1507px.
It's your call on how you want to fix it, but the simplest solution is probably to just change the #c2's bottom padding to 20px.
largo6 — 2012-01-26T03:05:37-05:00 — #7
thanks very much
if you don't mind i'm asking i can wait to the morning
- how did you calculated both elements heights ? in the final source code i can't see any height output for this elements
- in cases like this wich elements envolved ? if i understand from your answer: padding and border
maybe i don't understand what border is but I would never guess it's a factor in the final height
sdleihssirhc — 2012-01-26T03:58:34-05:00 — #8
By using Chrome's awesome Web Inspector, basically. If you right-click on the page, you can "Inspect Element" and get a wealth of information.
The problem is, what do you mean when you say "height"? The browser thinks you're only talking about the height of the content--not including padding or border. So it did what it thought you wanted it to do.
This is one of those things I forget every single time I mess with an element's height. It doesn't look quite right, and then I realize that I accidentally included some padding as well...
largo6 — 2012-01-26T05:08:45-05:00 — #9
thanks a lot for the help
molona — 2012-01-26T05:59:03-05:00 — #10