1.0.7 • Published 5 years ago

javascript-calculator v1.0.7

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

Javascript-Calculator

This is a Simple Javascript Calculator

Demo

Demo

Feature

  • Support Keyboard Key bindings;

Keyboard

  • Type 0 to 9 Numbers;
  • Shift plus + : will add the Numbers;
  • Shift plus * : will multiply the Numbers;
  • -: will subtract the Numbers;
  • / : will divide the Numbers;
  • = : will give the Output;
  • backspace : will clear the values;

Options

NameDescriptionType
backgroundchange the calculator backgroundString
numbersBackgroundchange the numbers box backgroundString
numbersColorchange the numbers box colorString
operatorsBackgroundchange the operators box backgroundString
operatorsColorchange the operators box colorString
clearAndEqualBackgroundschange the clear and equal box backgroundString
clearAndEqualColorschange the clear and equal box colorString

Note

Add index.js to your html file

Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Calculator</title>
    <script src="../node_modules/src/index.js"></script>
</head>
<body>
</body>
</html>

Step 1: add some class to the div.

<div class="wrapper"></div>

Step 2: Initialize the plugin on your page. For example

// initialize with defaults
$(".wrapper").javascriptCalcInit();

// initialize with options
$(".wrapper").javascriptCalcInit({
        background:'black',
        numbersBackground:'#8c4141',
        numbersColor:'white',
        operatorsBackground:'#FF5722',
        operatorsColor:'white',
        clearAndEqualBackgrounds:'#8c4141',
        clearAndEqualColors:'white',
});

Using NPM

To install using the npm package manager run:

$ npm install javascript-calculator

Contribute

Contributions are always welcome!