How can i put this SVG ‘Sidebar Menu’ in the right side?


Tags: javascript,jquery,html,css,snap.svg

Problem :

In the following link,

Link: SVG Sidebar Menu

there is some SVG nav example. The first one (with Sidebar Menu title) is ideal for me. But I need put it in the right side instead left.

How can I do that?

I put HTML and CSS that source code. but if you see that link, it's easier than to help me... .

HTML

        <nav id="menu" class="menu">
            <button class="menu__handle"><span>Menu</span></button>
            <div class="menu__inner">
                <ul>
                    <li><a href="#"><i class="fa fa-fw fa-home"></i><span>Home<span></a></li>
                    <li><a href="#"><i class="fa fa-fw fa-heart"></i><span>Favs<span></a></li>
                    <li><a href="#"><i class="fa fa-fw fa-folder"></i><span>Files<span></a></li>
                    <li><a href="#"><i class="fa fa-fw fa-tachometer"></i><span>Stats<span></a></li>
                </ul>
            </div>
            <div class="morph-shape" data-morph-open="M300-10c0,0,295,164,295,410c0,232-295,410-295,410" data-morph-close="M300-10C300-10,5,154,5,400c0,232,295,410,295,410">
                <svg width="100%" height="100%" viewBox="0 0 600 800" preserveAspectRatio="none">
                    <path fill="none" d="M300-10c0,0,0,164,0,410c0,232,0,410,0,410"/>
                </svg>
            </div>
        </nav>

CSS:

   .menu {
    position: fixed;
    width: 300px;
    top: 3em;
    bottom: 3em;
    left: 0;
    z-index: 100;
    overflow: hidden;
    -webkit-transform: translate3d(-150px, 0, 0);
    transform: translate3d(-150px, 0, 0);
    -webkit-transition: -webkit-transform 0.6s;
    transition: transform 0.6s;
}

.menu.menu--open {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

.main {
    -webkit-transition: opacity 0.6s;
    transition: opacity 0.6s;
}

.menu.menu--open + .main {
    opacity: 0.3;
    pointer-events: none;
}

.menu__inner {
    width: calc(100% + 25px);
    padding: 0 140px 2em 0;
    overflow-y: auto;
    height: 100%;
    position: relative;
    z-index: 100;
}

.menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu ul li {
    margin: 0 0 2em 0;
    -webkit-transform: translate3d(-150px, 0, 0);
    transform: translate3d(-150px, 0, 0);
    -webkit-transition: -webkit-transform 0.6s;
    transition: transform 0.6s;
}

.menu.menu--anim ul li {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

.menu ul li:first-child {
    -webkit-transition-delay: 0.3s;
    transition-delay: 0.3s;
}

.menu ul li:nth-child(2) {
    -webkit-transition-delay: 0.2s;
    transition-delay: 0.2s;
}

.menu ul li:nth-child(3) {
    -webkit-transition-delay: 0.1s;
    transition-delay: 0.1s;
}

.menu ul li a {
    display: block;
    outline: none;
}

.menu ul li .fa {
    font-size: 2.5em;
    display: block;
    margin: 0 auto;
    color: #5f656f;
}

.menu ul li span {
    font-weight: bold;
    font-size: 0.75em;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.menu__handle {
    background: #2f3238;
    border: none;
    width: 30px;
    height: 24px;
    padding: 0;
    outline: none;
    position: absolute;
    top: 3px;
    right: 70px;
    z-index: 2000;
}

.menu__handle::before,
.menu__handle::after,
.menu__handle span {
    background: #5f656f;
}

.menu__handle::before,
.menu__handle::after {
    content: '';
    position: absolute;
    height: 2px;
    width: 100%;
    left: 0;
    top: 50%;
    -webkit-transform-origin: 50% 50%;
    transform-origin: 50% 50%;
    -webkit-transition: -webkit-transform 0.25s;
    transition: transform 0.25s;
}

.menu__handle span {
    position: absolute;
    width: 100%;
    height: 2px;
    left: 0;
    overflow: hidden;
    text-indent: 200%;
    -webkit-transition: opacity 0.25s;
    transition: opacity 0.25s;
}

.menu__handle::before {
    -webkit-transform: translate3d(0, -10px, 0);
    transform: translate3d(0, -10px, 0);
}

.menu__handle::after {
    -webkit-transform: translate3d(0, 10px, 0);
    transform: translate3d(0, 10px, 0);
}

.menu--open .menu__handle span {
    opacity: 0;
}

.menu--open .menu__handle::before {
    -webkit-transform: rotate3d(0, 0, 1, 45deg);
    transform: rotate3d(0, 0, 1, 45deg);
}

.menu--open .menu__handle::after {
    -webkit-transform: rotate3d(0, 0, 1, -45deg);
    transform: rotate3d(0, 0, 1, -45deg);
}

.morph-shape {
    position: absolute;
    width: 240px;
    height: 100%;
    top: 0;
    right: 0;
}

.morph-shape svg path {
    stroke: #5f656f;
    stroke-width: 5px;
}

@media screen and (max-width: 63em) {
    .main {
        padding: 0 2em;
        -webkit-transition: opacity 0.6s;
        transition: opacity 0.6s;
    }

    .menu {
        -webkit-transform: translate3d(-170px, 0, 0);
        transform: translate3d(-170px, 0, 0);
    }

    .menu.menu--open + .main {
        opacity: 0.05;
    }
}


Solution :

There is a couple of things you have to change in order to mirror navigation to the right:

.menu {
    position: fixed;
    width: 300px;
    top: 3em;
    bottom: 3em;
    right: 0; // left: 0
    z-index: 100;
    overflow: hidden;
    -webkit-transform: translate3d(150px, 0, 0); // -webkit-transform: translate3d(-150px, 0, 0);
    transform: translate3d(150px, 0, 0); // transform: translate3d(-150px, 0, 0);
    -webkit-transition: -webkit-transform 0.6s;
    transition: transform 0.6s;
}


.menu__inner {
    width: 100%; // width: calc(100% + 25px);
    padding: 0 0 2em 120px; // padding: 0 140px 2em 0;
    overflow: hidden; // overflow-y: auto;
    height: 100%;
    position: relative;
    z-index: 100;
}


.menu ul li {
    margin: 0 0 2em 0;
    -webkit-transform: translate3d(150px, 0, 0); // -webkit-transform: translate3d(-150px, 0, 0);
    transform: translate3d(150px, 0, 0); // transform: translate3d(-150px, 0, 0);
    -webkit-transition: -webkit-transform 0.6s;
    transition: transform 0.6s;
}


.morph-shape {
    position: absolute;
    width: 240px;
    height: 100%;
    top: 0;
    left: 0; // right: 0;
    // add this to change morphing direction
    -webkit-transform: rotate(180deg);
    transform: rotate(180deg);
}

DEMO


    CSS Howto..

    how to select last element in the page?

    How to create border corner spacing in CSS

    Nth-child css property is counting html elements with display property set to none. How to change it?

    How to create spaces between elements in HTML/CSS

    image carousel showing all images

    How to alternate rowcolor in a GridView using pure CSS?

    How to handle CSS unable to load resource error

    How to Tie Events to CSS

    How can I get a block to print complicated divs horizontally?

    How to change a css element based on other element

    How do I link an external css to overwrite bootstrap css for centering elements?

    How to add external CSS to HTML 'style'

    How to create a speech bubble with css only

    How to remove the text from this html

    CSS - How to make position:absolute work not on all 100% screens area

    How to go about making an image move up in the div on hover

    How to implement :parent selector in css

    how to set button background such that it takes up height and width of parent div? what css property affects which dimension?

    How to make a floated element take the entire width of its parent

    How can I create CSS sprites from images stored in the database?

    Hide/Show Div Depending on Screen Width

    How to make hover use border-radius first-child

    How do I go about dynamically splitting a body of text into two even columns with plain Javascript (no JQuery)?

    How do you create a perfectly scalable button in HTML/CSS3/jQuery/Javascript using images to provide borders and corners?

    How can I keep percentage-based elements from overlapping?

    How to replace only the text of this element with jQuery?

    How to change floating div's width to fill all the space they occupy?

    How do I move the background image of a DIV based on the scrollbar movement?

    How to use Bootstrap CDN?

    How to change the width of a CSS flex-box column?