我有一个简单的过渡,在平稳地盘旋时将页脚img向上移动5px,但是Firefox不适用于平滑过渡.只有webkit.
我已正确声明所有供应商前缀,如下所示.
#footer img {
margin-left:8px;
-webkit-transition:all .1s ease;
-moz-transition:all .1s ease;
-ms-transition:all .1s ease;
transition:all .1s ease;
cursor:pointer;
#footer img:hover {
position:relative;
top:-5px;
Run Code Online (Sandbox Code Playgroud)
您可以在Safari/Chrome VS Firefox中自行查看.进入页脚,将鼠标悬停在每个项目上.
我正在尝试创建一些单击图像的东西,它只是被另一个相同尺寸的图像替换.
我几乎可以使用下面的jQuery,但它没有正确地改变类.'之前'图像有一个类,其中:悬停改变它的不透明度.点击后我不希望图像也这样做,所以我为'after'图像创建了第二个类.但是它不会改变类.
HTML:
<div id="vote">
<img src="images/icon-voteheart2.png" class="heart" />
<h2>12</h2>
</div>
Run Code Online (Sandbox Code Playgroud)
使用Javascript:
<script type="text/javascript">
$(function() {
$('.heart').click(function() {
$(".heart").fadeOut('fast');
$(".heart").fadeIn('fast');
$(".heart").attr('src', "images/icon-tick.png");
$(this).removeClass(".heart");
$(this).addClass(".heartnew");
return false;
});
});
< /script>
Run Code Online (Sandbox Code Playgroud)