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.html
file in your browser to see the effect in action.
- Replace
your-image.jpg
in theassets/
folder with your own image. - Adjust the
magnificationFactor
andmagnifierSize
variables in thescript.js
file to customize the effect. - Include the
style.css
andscript.js
files 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.