此脚本适用于single click
,但在double click
上,它会显示div #btnn
和#num
CSS
#num
{
padding: 15px;
display: none;
}
JQ
<script type="text/javascript">
$(document).ready(function() {
$(".deatil_view_b").toggle(function() {
$("#btnn").fadeOut('slow',function() {
$("#num").fadeIn('slow');
});
}, function(){
$("#num").fadeOut('slow', function() {
$("#btnn").fadeIn('slow');
});
});
});
</script>
答案 0 :(得分:1)
试试这个:
$(document).ready(function(){
$(".detail_view_b").toggle(function() {
$("#btnn").fadeOut('slow', function() {
$("#num").fadeIn('slow');
});
}, function() {
$("#num").fadeOut('slow', function() {
$("#btnn").fadeIn('slow');
});
});
$(".detail_view_b").dblclick(function() {
$("#btnn").clearQueue();
$("#num").clearQueue();
});
});
另请注意,我将“deatil_view_b”更正为“detail_view_b”。我认为这是一个错字。
答案 1 :(得分:0)
尝试使用.stop()
功能立即完成动画并继续:
$("#btnn").stop(true, true).fadeOut('slow',function() {
$("#num").fadeIn('slow');
});
$("#num").stop(true, true).fadeOut('slow', function() {
$("#btnn").fadeIn('slow');
});
请记住,双击不是Web应用程序中的标准事件。