I am designing a flyout panel mechanism like that of Microsoft Azure's online portal. Anyway the portal has this flyout panel mechanism which it uses for menus. If I open a new submenu, it comes out from left to right. The panel container is aligned left on the page.
So far so good. However, I need my panels on the right of my screen. I already came up with a solution but my only problem is that when I add a new flyout panel, it aprubtly repositions it's neighbor and then slides out using the show()
function.
https://jsfiddle.net/9ogn0kx4/1/
Basically, I need for the new panel to ease it's neighbor out as it slides into view. I hope you can understand my blabbering.
HTML:
<div id="flyoutcontainer" class="parentflyout">
<div class="childflyout" style="display:block;">
<button onclick="openNewFlyout('#flyoutcontainer')">OpenNew</button>
<button onclick="closePanel('#flyoutcontainer')">Close</button>
</div>
</div>
CSS
/*Temp*/
body, html{height: 100%;}
.parentflyout{
height:100%;
}
.childflyout:first-of-type{
width:200px;
}
.childflyout:nth-of-type(2){
overflow:hidden;
}
.childflyout{
border:1px solid black;
width: 340px;
float:right;
height:100%;
display: none;
}
JQuery
function openNewFlyout(containerid){
var newFlyout = $('<div class="childflyout"></div>');
var appended = $(containerid).prepend(newFlyout);
newFlyout.show('slide', {direction: 'right'}, 800);
}
function closePanel(containerid){
$(containerid + ' .childflyout:first-of-type').remove();
}
EDIT:
Here's what I basically mean. The "animation" in the red box is how it currently works. But I need for it to work like illustrated in the green box.