[JS Open Source Component development] Image Magnifier

Source: Internet
Author: User

Picture Magnifier

In general, the mobile phone because the screen is too small, there will be a picture of the problem, so I did a magnifying glass JS effect, support PC and mobile side. Its principle is to use the backgroundsize to achieve, so your browser first to support this property.

Then this component is also an open source Git project, and you can add a workaround for it that does not support backgroundsize. Its git address is: Image magnifier GitHub address https://github.com/tianxiangbing/image-zooming, its online demo address is: JS Picture Magnifier Demo address/HTTP/ Www.lovewebgames.com/jsmodule/image-zooming.html

Image-zooming

Picture Magnifier Example See demo

Examples of Use methods:

  

or Requirejs.

  

Properties and Methods Target dom|string
Image objects that need to be enlarged (image  only supported)
Times int
Zoom in multiples, default is twice times
Height:int
Height of Magnifier, default 100px
Width:int
Width of magnifier, default 100px
always bool
is always displayed, the default is False, and when you need to zoom in, you can display the magnifying glass when you click on the picture or touch.
Callback:function (A,B,C,D)
The magnifying glass moves the callback method, where parameter A is the position object of {x:11,y:11}, B\c is the location object to be positioned, and D is the DOM object of the magnifying glass

[JS Open Source Component development] Image Magnifier

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.