zoukankan      html  css  js  c++  java
  • angular1 自定义手风琴写法

    <body ng-app="myApp" class="body">


    <div ng-controller="AccordionDemoCtrl">
    <div ng-repeat="info in panelShow">
    <h2 ng-click="openCon($index)">{{info.title}}</h2>
    <!--ng-class="{'active':info.status}"-->
    <section class="con" ng-if="info.status">{{info.infoBox}}</section>
    </div>

    </div>

    </body>


    <script> var App = angular.module('myApp', []); App.controller('AccordionDemoCtrl', function ($scope) { $scope.panelStatus = false; var mySomething = [ { title:'UI设计', infoBox:'至少你要会画画吧' }, { title:'web程序员', infoBox:'至少你要会写代码吧' }, { title:'产品狗狗', infoBox:'至少你要会思考吧' } ]; $scope.panelShow = mySomething; angular.forEach($scope.panelShow,function(i){ i.status = false }); // var newPanel = $scope.panelShow; $scope.openCon =function(idx){ // 只打开唯一一个: // if($scope.panelShow[idx].status == false){ // angular.forEach($scope.panelShow,function(i){ // i.status = false // }); // } $scope.panelShow[idx].status = !$scope.panelShow[idx].status; } }); </s
  • 相关阅读:
    UVA 12307 Smallest Enclosing Rectangle
    UVALive 4728 Squares
    扩栈代码
    uva 10256 The Great Divide
    uva 11168 Airport
    uva 10625 Board Wrapping
    bzoj千题计划206:bzoj1076: [SCOI2008]奖励关
    NOIP2017 列队
    bzoj3529: [Sdoi2014]数表
    bzoj1966: [Ahoi2005]VIRUS 病毒检测
  • 原文地址:https://www.cnblogs.com/vonson/p/7801459.html
Copyright © 2011-2022 走看看