简体   繁体   English

如何使用角材料在绝对位置创建可折叠 div

[英]How to create a collapsible div in absolute position using angular material

I am trying to create a collapsible div using angular-material which should be fixed to the bottom left corner like shown on the image below.我正在尝试使用 angular-material 创建一个可折叠的 div,它应该固定在左下角,如下图所示。

Is that actually possible?这真的可能吗?

在此处输入图片说明

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM