如果/ else循环检查图像高度Wordpress

时间:2015-02-06 08:20:25

标签: javascript jquery css wordpress

我使用此代码隐藏了客户端请求的底部37个像素,它隐藏了所有blogpost图像的底部(它是一个版权标记),但现在她想要添加更大的图像,这样做&# 39; t底部有版权标记,因此必须全部显示,较大图像的大小为1843px,小图像的高度为351px。

基本上我必须检查"如果容器图像大于351px",则隐藏底部边框,否则,以全高显示图像。

但是,如果我在正常循环中添加以下代码,它就无法正常工作。

  $('.image_Container').each(function() {
    *var $this = $(this),
       w = $this.find('img').width(), // Width of the image inside .box
       h = $this.find('img').height() - 37; // Height of the image inside                 container

     $this.width(w).height(h); // Applies the changes to the images
  });

关于如何让它在循环中工作的任何想法?

0 个答案:

没有答案