html - 在鼠标悬停时缩放选取框标记中的图像

标签 html css image marquee

我使用选取框标签创建了一个简单的图片库,您可以在以下位置看到它:
http://jsfiddle.net/gunturumanohar/62ZHC/

<marquee id="gallery" behavior="alternative" style="width:700px;padding:6px;" onmouseover="this.stop();" onmouseout="this.start();">
    <img src="http://cssdeck.com/uploads/media/items/0/00kih8g.jpg" />
    <img src="http://farm9.staticflickr.com/8195/8098750703_797e102da2_z.jpg" />
</marquee>

CSS 是:

#gallery img:hover {
    -webkit-transform: scale(1.5); /*Webkit: increase size to 1.5x*/
    opacity: 1; /*default opacity*/
    z-index: 10; /*place hover image in front the non-hover images*/
}

我使用 css scale 在悬停时缩放图像,但这里的问题是当缩放(缩放)图像时,图像顶部和底部不显示。

我认为问题出在图像的父标记 marquee 上。
我该如何克服这个问题?

最佳答案

作为实验的概念很酷,但我建议不要将此方法用于实际网站。虽然选取框得到很好的支持,但不推荐使用(参见 - marquee tag still works, is it okay to use it?)。此外,还有更好的方法可以使动画更流畅。话虽这么说,我已经为您解决了这个问题(采纳或保留建议)。

#gallery {
    text-align: center;
    width: 610px;
    margin: -140px auto;
    padding-top: 260px;
    height: auto;
    width:700px;
}
#gallery:hover { height: 270px; }

有点 hack-ish,但你正在做的事情也是如此,所以我认为这可能没问题。

DEMO

关于html - 在鼠标悬停时缩放选取框标记中的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23902515/

相关文章:

c# - 如何将位图返回给浏览器 WebApi

linux - 使用终端显示图像而不会失去焦点

javascript - 无限旋转木马,放大效果极佳

html - 如何使用 Angular 将元素保存在数据库容器中?

html - 绝对 div 中的图像垂直高度

css - 获取具有不同背景颜色并延伸到屏幕边缘的两列

html - 是否可以检测图像是否已通过 img src ="... vs address bar/"作为文档加载”?

html - 压缩 flexbox 中的图像

html - 如何使用 -webkit-scrollbar-button 添加箭头

jquery - 如何使警报重叠?