Hello, I am currently working on developing a drawer component using Ember.js. If you want to view the progress so far, feel free to check out this jsbin http://jsbin.com/wulija/8/edit
My goal is to have the drawer look like the following initially:
+---------------------------+
| A B C |
+---------------------------+
... other page content ...
When an option is selected, the corresponding component will be displayed. The drawer should slide down to reveal content A and overlap the following page content.
+---------------------------+
| _A_ B C |
+---------------------------+
| | | Clicking on A slides down to show content A
| content A | V Following page content is covered by the drawer
+---------------------------+
If option B is clicked, content A will slide left and content B will slide in from the right. The height of the drawer will adjust according to the size of content B.
+---------------------------+
| A _B_ C |
+---------------------------+
| | | If content B has more content
| | | It will slide further down
|nt A <-- <-- Content B | V
| |
+---------------------------+
If the currently selected option is clicked again, the drawer will close.
+---------------------------+
| A _B_ C |
+---------------------------+ ^
| Close drawer
I have encountered a few challenges along the way:
One issue is with the sliding drawer adjusting its height based on the content size. Since all content-X elements are set to
position: absolute;
and moved using jQuery'stransform: translate
, the drawer does not extend properly because these elements do not occupy any space. Additionally,position: absolute;
elements cannot be hidden withoverflow-y: hidden;
.Another challenge is that each content-X has a different size and its data is fetched via AJAX requests, making the size unknown beforehand. Therefore, having a fixed length drawer is not feasible. Ideally, I would like the browser layout engine to allocate space dynamically as needed. This would require setting content-X elements to
position: static;
, resulting in the three contents stacking together vertically.