This article mainly introduces how to use js + jquery to crop images and all the sample code. The idea is very good. We recommend this article to our friends who need it. Now we have a personal portrait upload function when using the personal centers of various websites. After uploading a personal photo, the user may not meet the requirements of the website. Therefore, the user is required to crop the photo and generate an avatar based on the size of the cropped image. This feature is amazing. It was amazing when I didn't understand js. I thought it would be nice if I could understand the technology ~ Do you have the same idea ~ Haha ~~
Next we will use javascript to implement this function.
The Code is as follows:
Clip
Usage
$ ("# Container"). clip ({
ImgC: $ ("# imgC "),
BlockClass: "block ",
TipsClass: "tips"
});
ImgC: Specifies the image cropping container, that is, the image on the right.
BlockClass: block style name, that is, the slider style that can be dragged on the page, because it is afraid to duplicate the name with the style on other pages. The default value is block.
TipsClass: The style name of tips, that is, the style name of the span with left width height top displayed on the page. The default name is tips.