请看这个链接
html
<div id="getitnow">btn 1</div>
<div id="getitnow">btn 2</div>
<div id="getitnow">btn 3</div>
<div id="getitnow">btn 4</div>
<div id="slideout">
<div id="containclickme">
</div>
</div>
css
#slideout {
background: #666;
position: relative;
width: 300px;
height: 80px;
right:-300px;
margin-top:50px;
float:right;
}
#getitnow {
padding:10px;
border:1px solid #ccc;
width:100px;
}
脚本
$(function () {
// cache the sliding object in a var
var slideout = $('#slideout');
// click-me not clickme
$("#getitnow").toggle(function () {
// use cached object instead of searching
slideout.animate({
right: '0px'
}, {
queue: false,
duration: 500
});
}, function () {
// use cached object instead of searching
slideout.animate({
right: '-300px'
}, {
queue: false,
duration: 500
});
});
});
无论您单击哪个按钮,我都试图让滑出 div 正常工作。
当您单击第一个按钮时,它怎么会滑出?
我究竟做错了什么?