Skip to content

The calculator features a clean design, incorporating dark mode for user preference. The code is well-organized, and the responsiveness ensures usability across different devices. Overall, it provides a functional and visually appealing calculator experience.

Notifications You must be signed in to change notification settings

Suresh-Chelani/JavaScript-Simple-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Responsive JavaScript Calculator

Live site Click here

Descriptions for its functionality:

HTML Structure:

  • The HTML file defines the structure of a simple calculator web page.
  • It includes a <head> section with metadata, a title, links to external stylesheets and favicon.
  • The <body> section contains a calculator interface with buttons for digits, operators, and other functionalities.
  • It also includes a header (<h1>) with the text "Calculate Me!" and a footer indicating that it was made by Suresh.

CSS Styles (style.css):

  • The CSS file defines styling for the calculator and implements a dark mode feature.
  • It sets variable values for primary and secondary colors, button colors, display background, and more.
  • Styles are defined for the body, calculator container, input display, buttons, and media queries for responsiveness.
  • The dark theme is activated by the class dark-theam which changes color variables and adjusts the appearance.

JavaScript Logic (script.js):

  • The JavaScript file handles the logic of the calculator.
  • It initializes an empty expression string and selects all buttons with the class button.
  • Event listeners are added to the buttons to update the expression based on user input.
  • The eval function is used to evaluate the expression when the '=' button is clicked.
  • The AC button clears the expression, and the DEL button removes the last character.
  • The dark mode is implemented by toggling the class dark-theam on the body, and the toggle button's appearance is adjusted accordingly.

Dark and Light Mode Toggle (script.js):

  • The dark and light mode functionality is achieved using a slider button with the class toggle.
  • The function mcMover is called when the slider is clicked, toggling the dark-theam class on the body.
  • The slider's position is animated, and its background color changes to indicate the current mode.

Responsiveness:

  • The styles include media queries to make the calculator responsive on different screen sizes.
  • Adjustments are made for smaller screens by changing the width of the calculator box, button width, and input width.

General Notes:

  • The calculator has a clean and visually appealing design.
  • The dark mode feature provides a different color scheme for users who prefer a darker interface.
  • The code is well-organized and follows best practices.
  • Responsiveness is addressed through media queries, making the calculator usable on various devices.

In summary, the code implements a functional and aesthetically pleasing calculator with additional features like dark mode and responsiveness for a better user experience.

About

The calculator features a clean design, incorporating dark mode for user preference. The code is well-organized, and the responsiveness ensures usability across different devices. Overall, it provides a functional and visually appealing calculator experience.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published