·
2 commits
to main
since this release
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 structurestyle.css- Styling and grid layoutscript.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:
- Center Calculator: Places the calculator in the center of the screen
- Revert Back: Returns the calculator to its original position
- Change Position by px: Allows the user to input custom x and y coordinates
Installation
- Clone this repository
- Open
index.htmlin your browser
Future Improvements
- Add memory functions (M+, M-, MR)
- Implement keyboard support
- Improve mobile responsiveness
- Add themes/color options
License
Author
Mayank Raj
Feel free to contribute to this project by submitting issues or pull requests!