This is a follow up to a problem posted earlier. Click here to open it
我现在有以下代码,但是我无法获得看起来采用默认边框和填充的第二个按钮。请帮忙。感谢。
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#b1").animate({width:'0px', padding:'0', border:'0'}, { duration: 1000, queue: false });
$("#b2").animate({width:'200px', padding:"", border:""}, { duration: 1000, queue: false });
});
});
</script>
<style>
button {
min-width:0px;
height: 22px;
width: 200px;
}
#b2 {
width: 0px;
padding: 0;
border: 0;
}
</style>
</head>
<body>
<button id="b1">Start Animation</button><button id="b2">Animation Done</button>
</body>
</html>
答案 0 :(得分:0)
也许你可以解决如下
css代码:
button {
min-width:0px;
height: 22px;
width: 200px;
}
#b2 {
width: 0px; display:none;
}
jquery代码:
$("button").click(function(){
$("#b1").animate({width:'0px',padding:'0px'}, 1000,function(){$('#b1').hide();});
$("#b2").css('display','inline-block').animate({width:'200px'}, { duration: 1000, queue: false });
});
你可以在这里看到结果---&gt; http://jsfiddle.net/Junkie/4c9g3/