Parent CSS (jQuery)
Posted
by Glister
on Stack Overflow
See other posts from Stack Overflow
or by Glister
Published on 2010-04-28T17:39:35Z
Indexed on
2010/04/28
17:47 UTC
Read the original article
Hit count: 332
There is <dl>
with padding-top
<dl style="padding-top: 150px;">
<dt>text</dt>
<dd><img width="150" height="150" src="..." /></dd>
<dt>text 2</dt>
<dd><img width="150" height="250" src="..." /></dd>
<dt>text 3</dt>
<dd><img width="150" height="350" src="..." /></dd>
</dl>
The difference between images - height
.
Trying to write a script, which will change a height
of the <dl>
, when <dd>
is clicked.
Height should be taken from the height
attribute of the dd img
.
Tryed this, but it doesn't work:
$("#posters dd").click(function(){
var parent_padding = $(this).find("img").attr("height");
$(this).parent().css({"padding-top":parent_padding});
});
Thanks.
© Stack Overflow or respective owner