jquery中手風琴效果實用源代碼


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>手風琴效果</title>
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
    <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.18.custom.css" rel="stylesheet" />
    <script type="text/javascript">
    $(function(){
$("#accordion").accordion({
header: "h3",    //頭信息。頁面中div是什麼這就必須是什麼
event:"mouseover",  //面板展開的效果事件,默認是click
active:1,   //默認展開的面板,從0開始,默認值爲0
animated:"bounceslide", //面板展開的動畫效果
autoHeight:true,   //面板的高度是否是自動增高的,默認爲true
 fillSpace:true,  //填充到父元素
 icons:{
 //圖標的設置  header默認時的效果 headerSelected代表是面板激活狀態的效果圖標
  header:"ui-icon-carat-2-e-w",
  headerSelected:"ui-icon-carat-2-n-s"
 }
 }).sortable({
 axis:"y",   //表示只能在y軸上託拽排序  x軸   x,y默認x,y
 handle:"h3",   //只能拖拽h3
/* stop:function(event,ui){
 //stop事件  本身是一個匿名函數  event是瀏覽器自帶的事件處理對象  ui操作控件對象
 //alert("你要停止嗎?");
 ui.item.children("h3").triggerHandler("focusout");
 }*/
   });
 $("#accordion").bind("sortstop",function(event,ui){
 alert("hdsadhhds");
 });
});
    </script>
</head>
<body>
<div id="accordion" style="width:600px; height:400px; border:#0F0 solid 1px;">
<div>
<h3><a href="#">First</a></h3>
<div>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.</div>
</div>
<div>
<h3><a href="#">Second</a></h3>
<div>Phasellus mattis tincidunt nibh.</div>
</div>
<div>
<h3><a href="#">Third</a></h3>
<div>Nam dui erat, auctor a, dignissim quis.</div>
</div>
</div>
</body>
</html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章