js-calculator

JavaScript plugin calculator for web-browser.

Usage no npm install needed!

<script type="module">
  import jsCalculator from 'https://cdn.skypack.dev/js-calculator';
</script>

README

Calculator

NPM Version Download Month Download Total calculator on JavaScript

JavaScript plugin calculator for web-browser.

Demo calculator

Install

npm install js-calculator

Use

....
<head>
    ....
    <link rel="stylesheet" href="../css/calculator.css">
    ....
</head>
<body>
....
<div class="wrapper-calc">
    <div class="wrapper-calc__row">
        <input type="text" value="0" readonly>
    </div>
    <div class="wrapper-calc__left">
        <div class="wrapper-calc__row">
            <button>7</button>
            <button>8</button>
            <button>9</button>
            <button>÷</button>
        </div>
        <div class="wrapper-calc__row">
            <button>4</button>
            <button>5</button>
            <button>6</button>
            <button>x</button>
        </div>
        <div class="wrapper-calc__row">
            <button>3</button>
            <button>2</button>
            <button>1</button>
            <button>-</button>
        </div>
        <div class="wrapper-calc__row">
            <button>0</button>
            <button>.</button>
            <button>+</button>
            <button>C</button>
        </div>
    </div>
    <div class="wrapper-calc__left">
        <div class="wrapper-calc__row">
            <button>←</button>
        </div>
        <div class="wrapper-calc__row">
            <button>=</button>
        </div>
    </div>
</div>
....
<script src="../js/app.js"></script>
....
</body>
<script>
    window.onload = function () {
        calc.init();
    };
</script>

License

Copyright (c) 2016 Dmitriy Belenov

npm