'Floating action button issue

Included Example to what i have in the Floating action button

how to make the content of the Floating action button take their position dynamic without using >>> transform: translateY(-250%);

because this is a fixed way

any help so i can fix this issue

It looks like your post is mostly code; please add some more details.

It looks like your post is mostly code; please add some more details.

It looks like your post is mostly code; please add some more details.

  $('#FABMG').click(function () {
            $('#FABMG').toggleClass('show');
            $('#overlay').toggleClass('show');
            $('.nav').toggleClass('show');
        });
        * {
            box-sizing: border-box;
            padding: 0;
            margin: 0;
            font-family: "Roboto", sans-serif;
            font-weight: 400;
            font-size: 16px;
            line-height: 1.3;
        }

        #image {
            z-index: 0;
        }

        #image img {
            display: block;
            margin-right: auto;
            margin-left: auto;
            width: 100%;
            max-width: 820px;
        }

        #text {
            z-index: 0;
            padding: 18px 38px;
        }

        #overlay {
            z-index: 2;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(220, 220, 220, 0.7);
            visibility: hidden;
            opacity: 0;
            transition: all 0.2s ease-in;
            will-change: opacity;
        }

        #overlay.show {
            visibility: visible;
            opacity: 1;
        }

        #FABMG {
            z-index: 10;
            position: fixed;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            bottom: 10%;
            right: 5%;
            background-color: #94C03D;
            width: 56px;
            height: 56px;
            border-radius: 50%;
            cursor: pointer;
            box-shadow: 2px 2px 10px rgba(10, 10, 10, 0.3);
            transition: all 0.2s ease-in-out;
        }

        #FABMG .icon-bar {
            display: block;
            background-color: #FFFFFF;
            width: 22px;
            height: 2px;
            transition: all 0.3s ease-in-out;
        }

        #FABMG .icon-bar+.icon-bar {
            margin-top: 4px;
        }

        .nav {
            z-index: 9;
            position: fixed;
            bottom: 10.5%;
            right: 5.5%;
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background-color: #f9f9f9;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            visibilty: hidden;
            opacity: 0;
            box-shadow: 3px 3px 10px 0px rgba(0, 0, 0, 0.48);
            cursor: pointer;
            transition: all 0.3s ease-in;
        }

        .material-icons {
            font-size: 24px;
            color: rgba(0, 0, 0, 0.54);
        }

        #settings.show {
            transform: translateY(-125%);
        }

        #thumb.show {
            transform: translateY(-250%);
        }

        #create.show {
            transform: translateY(-375%);
        }

        #share.show {
            transform: translateY(-500%);
        }

        #FABMG.show {
            box-shadow: 7px 7px 10px 0px rgba(0, 0, 0, 0.48);
        }

        #FABMG.show #wrapper {
            transition: transform 0.4s ease-in-out;
            transform: rotateZ(90deg);
        }

        #FABMG.show #one {
            transform: translateY(6px) rotateZ(45deg) scaleX(0.9);
        }

        #FABMG.show #thr {
            transform: translateY(-6px) rotateZ(-45deg) scaleX(0.9);
        }

        #FABMG.show #two {
            opacity: 0;
        }

        .nav.show {
            visibility: visible;
            opacity: 1;
        }
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>


</head>

<body>

    <div id="FABMG">
        <div id="wrapper">
            <span class="icon-bar" id="one"></span>
            <span class="icon-bar" id="two"></span>
            <span class="icon-bar" id="thr"></span>
        </div>
    </div>
    <div class="nav" id="settings">
        <i class="material-icons">settings</i>
    </div>
    <div class="nav" id="thumb">
        <i class="material-icons">thumb_up</i>
    </div>
    <div class="nav" id="create">
        <i class="material-icons">create</i>
    </div>
    <div class="nav" id="share">
        <i class="material-icons">share</i>
    </div>




</body>

</html>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source