[英]How to create a collapsible div in absolute position using angular material
Yes, it is doable.是的,这是可行的。 There is a github repository if you want to implement chat window like you are saying.如果你想像你说的那样实现聊天窗口,有一个 github 存储库。
https://github.com/irontec/angular-bootstrap-simple-chat https://github.com/irontec/angular-bootstrap-simple-chat
But, if you want to tweak yourself then here is the code for collapsable
div.但是,如果你想调整自己,那么这里是collapsable
div 的代码。 Good luck.祝你好运。
http://jsfiddle.net/hungerpain/eK8X5/7/ http://jsfiddle.net/hungerpain/eK8X5/7/
You would have to use CSS - CodePen你将不得不使用 CSS - CodePen
Markup标记
<div ng-controller="AppCtrl" ng-cloak="" ng-app="MyApp" layout-fill>
<div id="chatWindow" layout="column" style="height:{{status==='Open'?'50px':'200px'}}">
<md-button ng-click="toggle()">{{status}}</md-button>
</div>
</div>
JS JS
angular.module('MyApp',['ngMaterial', 'ngMessages'])
.controller('AppCtrl', function($scope) {
$scope.status = "Open";
$scope.toggle = function () {
$scope.status = ($scope.status === "Open") ? "Close" : "Open";
}
});
CSS CSS
body {
background: purple;
}
#chatWindow {
display: block;
width: 300px;
position: absolute;
bottom: 0;
left: 0;
background: yellow;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.