【发布时间】:2016-02-03 08:12:13
【问题描述】:
我想在悬停时缩放背景图像。
下面的代码不会缩放背景图像。相反,它会缩放前面的面板。 问题是,我没有任何用于 img 的 div 标签。我在正文中添加了一个类。
.imageNeutral{
background-image: url('../App/Images/nature.jpg');
/*background-attachment: fixed;*/
opacity: 0.8;
overflow: auto;
}
.imageNeutral{
-webkit-transition: all 3s ease;
-moz-transition: all 3s ease;
-o-transition: all 3s ease;
-ms-transition: all 3s ease;
transition: all 3s ease;
max-width: 100%;
}
.imageNeutral:hover
-webkit-transform:scale(1.05);
-moz-transform:scale(1.05);
-ms-transform:scale(1.05);
-o-transform:scale(1.05);
transform:scale(1.05);
}
在javascript中:
$("body").addClass('imageNeutral');
所有其他元素都被缩放,但不是图像。我只是想放大图像。
.imageNeutral img:hover 也不起作用。
你知道我做错了什么吗?
【问题讨论】:
-
你试过搜索这个问题吗?
标签: javascript html css