collapse transition not working with angular's UI Bootstrap

后端 未结 1 566
情深已故
情深已故 2021-02-13 01:59

I\'m trying to create a div which will show / hide when a button is clicked. The UI Bootstrap page shows a nice simple example that uses a css transition.

Here\'s my fi

相关标签:
1条回答
  • 2021-02-13 02:53

    Just downgrade the ui-bootstrap version to 0.12.0. There is a bug in 0.13.0 that makes the animation not work.

    <html>
    <head>
        <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
        <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css" />
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.0/ui-bootstrap.js"></script>
    
    </head>
    <body ng-app="my_app">
        <div ng-controller="CollapseDemoCtrl">
            <button class="btn btn-default" ng-click="isCollapsed = !isCollapsed">Toggle collapse</button>
            <hr />
            <div collapse="isCollapsed">
                <div class="well well-lg">Some content</div>
            </div>
        </div>
    </body>
    </html>

    The JS can stay the same. I just modified the ui-bootstrap version in the html code.

    Here is the updated fiddle as well - https://jsfiddle.net/xv7tws10/5/

    Edit: See Premchandra's response below. Apparently you have to include ng-animate in order to get collapse animation to work in angular 1.3.

    0 讨论(0)
提交回复
热议问题