Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="greenulator">
    <p class="info">
        Made with <span>♥</span> by:
        <a href="https://dribbble.com/shots/2296125-004-Calculator" target="_blank">Milan</a>'s design
        and
        <a href="https://codepen.io/Momciloo" target="_blank">Momcilo</a>'s code</p>
    <header>
        <a href="javascript:;" class="nav options">
            <span></span>
            <span></span>
            <span></span>
        </a>
        <a href="javascript:;" class="settings">
            <img src="https://s28.postimg.org/8kt4ng6mx/settings.png" alt="" />
        </a>
        <h1>Greenulator</h1>
        <nav role='navigation' class="offscreen options">
          <ul>
            <li><a href="#">Standard</a></li>
            <li><a href="#">Scientific</a></li>
            <li><a href="#">Programmer</a></li>
            <li><a href="#">Contact Us</a></li>
          </ul>
        </nav>
    </header>
    <section>
        <input type="text" id="display" maxlength="4" disabled="disabled" class="display" value="" />
        <div class="buttons">
            <button href="javascript:;" class="btn symbol" value="√" onclick="sqrRoot()">√	</button>
            <button href="javascript:;" class="btn symbol" onclick="set('(')">(</button>
            <button href="javascript:;" class="btn symbol" onclick="set(')')">)</button>
            <button href="javascript:;" class="btn symbol" value="%">%</button>
            <button href="javascript:;" class="btn" onclick="set('7')">7</button>
            <button href="javascript:;" class="btn" onclick="set('8')">8</button>
            <button href="javascript:;" class="btn" onclick="set('9')">9</button>
            <button href="javascript:;" class="btn" onclick="set('/')">/</button>
            <button href="javascript:;" class="btn" onclick="set('4')">4</button>
            <button href="javascript:;" class="btn" onclick="set('5')">5</button>
            <button href="javascript:;" class="btn" onclick="set('6')">6</button>
            <button href="javascript:;" class="btn" onclick="set('*')">×</button>
            <button href="javascript:;" class="btn" onclick="set('1')">1</button>
            <button href="javascript:;" class="btn" onclick="set('2')">2</button>
            <button href="javascript:;" class="btn" onclick="set('3')">3</button>
            <button href="javascript:;" class="btn" onclick="set('-')">-</button>
            <button href="javascript:;" class="btn long" value="0" onclick="set('3')">0</button>
            <button href="javascript:;" class="btn" value=".">.</button>
            <button href="javascript:;" class="btn tall right" value="+" onclick="set('+')">+</button>
            <button href="javascript:;" class="btn pink" onclick="ce()">Del</button>
            <button href="javascript:;" class="btn green long" value="=" onclick="answer()">=</button>
        </div>
    </section>
</div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600);
@import "compass/css3";

$white: #ffffff;
$bg: #f8f8f8;
$green: #81c784;
$btn: #f2f2f2;
$btnclr: #666666;
$pink: #f50057;
$bgimg: url('https://s2.postimg.org/98212qd4p/photo_1418065405408_4ce6db0edded.jpg');
$clcwidth: 750px;

* {@include box-sizing(border-box); @include user-select(none);}
body {
    font-family: 'Source Sans Pro', sans-serif;
    background-image: $bgimg;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
    background-position: bottom center;
}
.greenulator {
    width: 450px;
    margin: 50px auto 150px;
    background-color: $bg;
    position: relative;
    @include border-bottom-radius(5px);
    overflow: hidden;
    header {
        background-color: $green;
        padding: 28px 18px 15px;
        position: relative;
        .details {
            
        }
        h1 {
            text-align: center;
            display: block;
            margin: 0 auto;
            width: 150px;
            font-weight: 600;
            color: $white;
            font-size: 21.6px;
        }
        .nav {
            cursor: pointer;
            display: block;
            width: 24px;
            height: 28px;
            float: left;
            margin-top: 3px;
            span {
                width: 100%;
                height: 2px;
                background-color: $white;
                display: block;
                &:not(:first-of-type) {
                    margin-top: 5px;
                }
            }
            &:hover {
                @include opacity(0.7s);
                span:first-of-type {
                    width: 70%;
                    @include transition(all 0.2s);
                    & + span {
                        width: 80%;
                        @include transition(all 0.4s);
                        & + span {
                            width: 90%;
                            @include transition(all 0.6s ease-in-out);
                        }
                    }
                }
            }
        }
        .settings {
            float: right;
            width: 22px;
            @include transition(all 0.3s);
            img {
                width: 100%;
                height: auto;
            }
            &:hover {
                margin-top: -1px;
                @include opacity(0.8);
                @include transform(rotate(90deg));
            }
        }
    }
    section {
        width: 100%;
        float: left;
        padding: 0 15px 30px 27px;
        background-color: $bg;
        .display {
            width: 100%;
            float: left;
            height: 153px;
            background: transparent;
            border: none;
            font-size: 54px;
            padding: 0 12px;
            text-align: right;
            color: #1a1a1;
            direction: ltr;
        }
        .buttons {
            height: 100%;
            display: block;
            width: 100%;
            float: left;
            .btn {
                cursor: pointer;
                border: none;
                @include user-select(none);
                float: left;
                color: $btnclr;
                font-size: 28.79px;
                font-weight: 600;
                margin: 0 12px 12px 0;
                text-decoration: none;
                background-color: $btn;
                @include border-radius(5px);
                width: 90px;
                height: 84px;
                text-align: center;
                line-height: 84px;
                vertical-align: middle;
                outline: none;
                &:hover { background-color: darken($btn, 1% ); }
                &:active { background-color: darken($btn, 5% ); }
                &.right { float: right;}
                &.green { 
                    background-color: $green; 
                    color: $white;
                    &:active { background-color: darken($green, 5% );}
                }
                &.symbol {
                    width: 90px; height: 60px;
                    line-height: 60px;
                }
                &.pink { 
                    background-color: $pink; 
                    color: $white;
                    &:active { background-color: darken($pink, 5% );}
                }
                &.long { width: 192px; }
                &.tall { height: 180px; line-height: 180px;}
            }
        }
    }
    nav {
        width: 100%;
        float: left;
        position: absolute;
        margin-left:-18px;
        @include transition(all 0.4s);
        @include opacity(1);
        ul {
            background-color: $green;
            padding: 70px 0 600px;
            text-align: left;
            font-size: 40px;
            width: 100%;
            li {
                @include transition(all 1s);
                margin-left: 50px;
            }
            a {
                color: $white;
                margin-bottom: 15px;
                display: block;
                text-decoration: none;
                &:after {
                    display: block;
                    margin-top: 5px;
                    content: '';
                    background-color: $white;
                    height: 5px;
                    width: 0;
                    @include transition(all 0.2s);
                }
                &:hover {
                    &:after {
                        width: 30px;
                    }
                }
                &:active {
                    &:after {
                        width: 55px;
                    }
                }
            }
        }
        &.offscreen {
            margin-left: -468px;
            @include opacity(0);
            ul li {
                &:first-child {
                    margin-left: -50px;
                    & + li {
                        margin-left: -150px;
                        & + li {
                            margin-left: -250px;
                            & + li {
                                margin-left: -350px;
                            }
                        }
                    }
                }
            }
        }
    }
}
.info {
    display: none;
    padding: 20px;
    background-color: $green;
    color: $white;
    font-weight: 300;
    font-size: 14px;
    text-align: right;
    span {
        color: $pink;
        font-size: 16px;
    }
    a {
        color: $white;
        font-weight: 600;
        &:hover {
            text-decoration: none;
        }
    }
}
              
            
!

JS

              
                // thanks to Dennis J S's pen: 
// https://codepen.io/dennisjsk/pen/GsyEa
function set(op) {
    document.getElementById("display").value += op;
}
temp = '';
    $("#answer").val('') 
function sqrRoot() {
    var tempStore = document.getElementById("display").value;
    document.getElementById("display").value = eval(Math.sqrt(tempStore));
}
function setOp() {
    alert("gf");
    //document.getElementById("display").value += op;
}
function answer() {
    var Exp = document.getElementById("display");
    var Exp1 = Exp.value;
    var result = eval(Exp1);
    //alert(result);
    Exp.value = result;
}
function ce() {
    document.getElementById("display").value = '';
}

// and navigation

$('.options').click(function(){
   $('header nav.options').toggleClass('offscreen'); 
});
$('.settings').click(function(){
   $('.info').slideToggle();
});

              
            
!
999px

Console