[英]What's wrong this jQuery code? (Img height)
我要這個:
如果img高度大於187px,則獲得具有單個像素的padding-top屬性。(當前img高度-(減)187px)。
編碼:
$(document).ready(function() {
$(".tabbed-area .box-wrap .box img").load(function() {
$imgh = $(this).height();
if($imgh < 187)
{
$real = $imgh - 187;
$(this).css("padding-top", $real);
}
});
});
您正在說“ img高度大於187px”
當您檢查小於<
時,可能是對此的問題更改:
if($imgh > 187)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.