热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

放大流体网格内的图像-Zoominimageinsidefluidgrid

Iamusingisotopepluginforfluidgridandwouldliketoaddsomeeffectsforimagesonhover,in

I am using isotope plugin for fluid grid and would like to add some effects for images on hover, in this the grid has 3 different images with different height: jsfiddle code. Is there some way to keep them responsive and fix heigh change on hover zoom? Please suggest, what has been done wrong?

我正在使用同位素插件进行流体网格,并希望在悬停时为图像添加一些效果,在此网格中有3个不同高度的图像:jsfiddle代码。有没有办法让他们保持响应并修复悬停缩放的高度变化?请建议,做错了什么?

HTML




CSS

.item {
  width: 46.1%;
  height: auto;
  margin-right: 4%;
  margin-bottom: 30px;
  float: left;
  overflow: hidden;
}   

#social_indicator {
  font-size: 14px;
  font-weight: 300;
  font-style: italic;
  text-align: right;
  margin-top: 0;
  margin-bottom: 0;
}

.item img {
  width: 100%;
  height: 100%;
  -webkit-transition: all 3s ease;
  -moz-transition:    all 3s ease;
  -o-transition:      all 3s ease;
  -ms-transition:     all 3s ease;
  transition:         all 3s ease;
}

.item img:hover {
  width:   105%;
  height:  105%;
  margin-right: 1%;
  margin-bottom: 1%;
}

}

1 个解决方案

#1


2  

First, the overflow:hidden; should be on the div, not the image.

一,溢出:隐藏;应该是div,而不是图像。

I would set the height of the div with jQuery to prevent it from scaling, when the image does:

我将使用jQuery设置di​​v的高度,以防止它缩放,当图像执行时:

$('.item > a > img').each(function(index, value){
    $(value).parent('a').parent('.item').height( $(value).height() );
});

Remember to add the jQuery-library in your :

记得在中添加jQuery库:



推荐阅读
author-avatar
wgol992015
这个家伙很懒,什么也没留下!
Tags | 热门标签
RankList | 热门文章
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有