【发布时间】:2014-05-04 16:32:40
【问题描述】:
我想让按下按钮触发一波动画, 使用 .water:hover 事件可以成功实现, 但不知道如何使用按钮触发, 我尝试使用按钮触发类:focus事件,但不成功...
.water {
width: 300px;
height: 300px;
background-image: url("waves.png");
margin: 0 0 30px 0;
-webkit-transition: width 2s ease, height 2s ease;
-moz-transition: width 2s ease, height 2s ease;
-o-transition: width 2s ease, height 2s ease;
-ms-transition: width 2s ease, height 2s ease;
transition: all 3s ease-out;
}
.water:hover {
width: 500px;
height: 500px;
transition: all 3s ease-out;
}
更改触发器类型
.water {
width: 300px;
height: 300px;
background-image: url("waves.png");
margin: 0 0 30px 0;
-webkit-transition: width 2s ease, height 2s ease;
-moz-transition: width 2s ease, height 2s ease;
-o-transition: width 2s ease, height 2s ease;
-ms-transition: width 2s ease, height 2s ease;
transition: all 3s ease-out;
}
.water:focus {
width: 500px;
height: 500px;
transition: all 3s ease-out;
}
html jQuery 中按钮的处理方法
$(function() { $('#digitButton1').click(function(event) {
$('.water').addClass('focus');
});
});
$(document).ready(function() {
$('.water').not($(this)).removeClass('focus');
});
我该怎么办?谢谢
【问题讨论】:
标签: jquery html animation triggers transform