티스토리 뷰

jQuery/Effects

jQuery: sliding

carrot62 2020. 7. 30. 16:50
  • slideDown
$(selector).slideDown(speed,callback);
  • slideUp
  • slideToggle

예제)

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script> 
$(document).ready(function(){
  $("#flip").click(function(){
    $("#panel").slideToggle("slow");
  });
});
</script>
<style> 
#panel, #flip {
  padding: 5px;
  text-align: center;
  background-color: #e5eecc;
  border: solid 1px #c3c3c3;
}

#panel {
  padding: 50px;
  display: none;
}
</style>
</head>
<body>
 
<div id="flip">Click to slide the panel down or up</div>
<div id="panel">Hello world!</div>

</body>
</html>

'jQuery > Effects' 카테고리의 다른 글

jQuery: animate, stop, chaining  (0) 2020.07.30
jQuery: Fading  (0) 2020.07.30
jQuery: hide, show, toggle, callback functions  (0) 2020.07.30