手风琴

head部分:

html部分:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</head>
<body ng-app= "myApp"  style= "background:#4A4A4A"  class= "row" > //ng-app 是告诉angular, body里面的内容归他管
     <div style= "color:#fff; font-size:30px; font-weight:bold; text-shadow:3px 3px 3px #ccc;-webkit-text-shadow:3px 3px 3px #ccc; text-align:center; margin-top:30px;" >FE-演示平台</div>
     <section ng-controller= "html5Demo"  class= "col-md-6"  style= "margin:50px auto; float:none" >   //ng-controller angular的控制器在下面js要有对应的部分
         <p>
         <button class= "btn btn-dufault btn-sm"  ng-click= "status.open = !stasus.open"  style= "margin-right:8px;" >打开最后一个</button><button class= "btn btn-sm"  ng-click= "status.isDisabled = !status.isDisabled"  >禁止第一个</button>
         </p>  //ng-click  顾名思义,angular的点击事件。 !非运算符
         <label  for = ""  class= "checkbox"  style= "color:#fff; padding-left:20px;" >
             <input type= "checkbox"  ng-model= "oneAtATime"  >   //ng-model  angular的一个叫oneAtATime模块
             在同一时间只能打开一个
         </label>
      <accordion close-others= "oneAtATime" >   //关联着上面的ng-model 
         <accordion-group heading= "www.html5jq.com---angular手风琴"  is-open= "status.FirstOpen"  is-disabled= "status.isDisabled" >   
         </accordion-group>
         <accordion-group heading= "{{group.title}}"  ng-repeat= "group in groups" >    //ng-repeat  循环 。
             {{group.content}}
         </accordion-group>   
         <accordion-group heading= "html5jq FE国内最好的学习平台" >
             <p>这里有最新的资源及实例</p>
             <button class= "btn btn-default btn-sm"  ng-click= "addItem()" >点击添加</button>
             <section ng-repeat= "item in items" >
                 {{item}}
             </section>
         </accordion-group>   
         <accordion-group is-open= "status.open" >
             <accordion-heading>
                 欢迎提出bug及建议已便于我们改进!<i class= "pull-right glyphicon"  ng-class= "{'glyphicon-chevron-down': status.open, 'glyphicon-chevron-right': !status.open}" ></i>
             </accordion-heading>
             thanks
         </accordion-group>
     </accordion-group>
     </section>
</body>

js部分:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<script>
     angular.module( 'myApp' ,[ 'ui.bootstrap' ]).controller( 'html5Demo' function  ($scope) {
     $scope.oneAtATime =  true ;
     $scope.groups = [{
         title :  'one-1' ,
         content :  'one-1-content'
     },{
         title :  'one-2' ,
         content :  'one-2-content'
     }];
     $scope.items = [ 'Item 1' 'Item 2' 'Item 3' ];
     $scope.addItem =  function (){
         var  newItemNo = $scope.items.length + 1;
         $scope.items.push( 'Item'  + newItemNo)
     }    
      $scope.status = {
        isFirstOpen:  true ,
         isFirstDisabled :  false
     }
});
</script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值