jQuery09 元件選取(html元素+CSS ID)+元件滑動顯示/隱藏

jQuery09 元件選取(html元素+CSS ID)+元件滑動顯示/隱藏

jQuery09 元件選取(html元素+CSS ID)+元件滑動顯示/隱藏

 

資料來源http://www.w3school.com.cn/jquery/index.asp

code2html:http://tohtml.com/

<!DOCTYPE html>
<html>
<head>
<title>jQuery 元件選取(html元素+CSS ID)+元件滑動顯示/隱藏</title>
<style type="text/css">
div.panel,p.flip
{
margin:0px;
padding:5px;
text-align:center;
background:#e5eecc;
border:solid 1px #c3c3c3;
}
div.panel
{
height:120px;
display:none;
}
</style>
<!--資料來源	http://www.w3school.com.cn/jquery/index.asp-->
<scriptsrc="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
/*HTML+class作為選擇器*/
$("button.flip01").click(function(){
console.log("flip01");
$("div.panel").slideDown("slow");
});
$("button.slideUp01").click(function(){
console.log("slideUp01");
$("div.panel").slideUp("slow");
});
});
</script>
</head>
<body>
<buttontype="button"class="flip01">flip()-滑動顯示</button>
<buttontype="button"class="slideUp01">slideUp()-滑動隱藏</button>
<divclass="panel">
<p>My name is jash.liao.</p>
<p>I am a SW.</p>
</div>
</body>
</html>

 

 


發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *