A JS magnify lens effect for images. This project allows you to add a magnifying glass effect to any image, complete with adjustable magnification via the scroll wheel.
demo_resized.mp4
- Smooth magnification effect that follows the mouse cursor.
- Adjustable lens size and magnification level using the scroll wheel.
- Easy to integrate and customize.
-
Clone the repository:
git clone https://github.com/bdekraker/magnifier-lens-effect.git
-
Open the
src/index.htmlfile in your browser to see the effect in action.
- Replace
your-image.jpgin theassets/folder with your own image. - Adjust the
magnificationFactorandmagnifierSizevariables in thescript.jsfile to customize the effect. - Include the
style.cssandscript.jsfiles in your project to integrate the magnifier effect.
- Magnification Factor: Controls the zoom level of the magnifier lens. Adjust the initial value in
script.js. - Lens Size: Controls the diameter of the magnifier lens. The size can be adjusted dynamically via the scroll wheel.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please submit a pull request or open an issue to discuss improvements or report bugs.