我在这里有这个测试: //jsbin.com/epihis/2/edit
我有三个段落在单击时一个接一个地向上滑动。一旦所有的段落都被隐藏了,我想显示一个按钮来滑动它们。
我怎么做?
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){
//jQuery mouseover function
$("p#hovercolor").mouseover(function(){
$("p#hovercolor").css("background-color","yellow");
});
//jQuery mouseout function
$("p#hovercolor").mouseout(function(){
$("p#hovercolor").css("background-color","green");
});
//jQuery click function
$('input[name="Colorbtn"]').click(function(){
$('.myBox').css('background', '#00aeef');
$('.myBox').css('color', '#fff');
});
$('input[name="discolorbtn"]').click(function(){
$('.myBox').css('background', '#fff');
$('.myBox').css('color', '#000');
});
//Hide the matched elements with a sliding motion.
$('p.sliderhider').click(function(){
$(this).slideUp();
});
});
</script>
</head>
<body>
<p id="hovercolor">Move the mouse pointer over this paragraph.</p>
<div class="myBox" style="border:1px solid blue; width:150px; height:150px; margin-bottom:20px;">
BOX 1
</div>
<input type="button" value="Color myBox" name="Colorbtn"/>
<input type="button" value="Dis-Color myBox" name="discolorbtn"/><br /><br />
<hr>
<p class="sliderhider" style="display:block; background: yellow; width:200px">Slide this up one at a time</p>
<p class="sliderhider" style="display:block; background: yellow; width:200px">Slide this up one at a time</p>
<p class="sliderhider" style="display:block; background: yellow; width:200px">Slide this up one at a time</p>
</body>
</html>