Skip to content

v1.2-calculator

Latest

Choose a tag to compare

@mayank-0103 mayank-0103 released this 09 Mar 15:45
· 2 commits to main since this release
bec9d57

JavaScript Calculator (v1.2)

A simple, interactive calculator built with HTML, CSS, and JavaScript.

🚀 New Features & Modifications

  • Added some mathematical, trigonometric functions:
    • Added square root, log10, ln(natural logarithm), power, sin, cos, tan.
  • Bug Fixes:
    • Ensured that calculator doesn't moves when mousedown over calculator and mouseup outside the calculator

Features

  • Basic arithmetic operations (addition, subtraction, multiplication, division)
  • Clear display functionality
  • Responsive grid layout
  • Position customization:
    • Center the calculator on the screen
    • Revert to original position
    • Set custom positions with pixel values
    • NEW: Addition of some useful features

Project Structure

  • index.html - The calculator's HTML structure
  • style.css - Styling and grid layout
  • script.js - Calculator functionality and position control

How It Works

The calculator uses a grid-based layout with buttons for numbers and operations. When a button is clicked, the corresponding value is appended to the display. The calculation is performed using JavaScript's eval() function when the equals button is pressed.

Positioning Features

The calculator now comes with four positioning options:

  1. Center Calculator: Places the calculator in the center of the screen
  2. Revert Back: Returns the calculator to its original position
  3. Change Position by px: Allows the user to input custom x and y coordinates

Installation

  1. Clone this repository
  2. Open index.html in your browser

Future Improvements

  • Add memory functions (M+, M-, MR)
  • Implement keyboard support
  • Improve mobile responsiveness
  • Add themes/color options

License

MIT

Author

Mayank Raj


Feel free to contribute to this project by submitting issues or pull requests!