开发者

How to set a value to another elements height

开发者 https://www.devze.com 2023-02-03 08:11 出处:网络
I have a list of images on my website, and I because of different resolutions on viewers screens, the tot开发者_JAVA技巧al height of the div changes. I need to set the \"top\" value as the height of \

I have a list of images on my website, and I because of different resolutions on viewers screens, the tot开发者_JAVA技巧al height of the div changes. I need to set the "top" value as the height of ".photoswrap". Thanks for any help.


 $("#something").css("top", $(".photoswrap").css("height"));


I cannot give a working answer with seeing the code, but:

var $someDiv = $('div');
$someDiv.css('top', $('.photoswrap', $someDiv).height());

Or if .photoswrap is not inside of the div specifically:

$('div').css('top', $('.photoswrap').height());
0

精彩评论

暂无评论...
验证码 换一张
取 消