
¼ò½é
jQuery.eraser ÊÇÒ»¸ö»ùÓÚ jQuery µÄ²å¼þ£¬ËüµÄЧ¹ûÀàËÆÓÚÏðÆ¤²Á£¬°´×¡Êó±ê²»·Å£¬ÔÚͼƬÉÏÃæÀ´»ØÒƶ¯£¬ÉÏÃæ»ÒÉ«µÄͼƬ¾Í»á±»²Á³ö£¬ÏÔʾ³öÏÂÃæ²ÊÉ«µÄͼƬ¡£
jQuery.eraser µÄÔÀíÆäʵÊÇÓлÒÉ«¡¢²ÊÉ«Á½ÕÅͼƬ£¨¶¼ÐèÒª×Ô¼ºÊÂǰ׼±¸£©£¬½«»ÒÉ«µÄÍ¼Æ¬×°ÔØÓÚÒ»¸ö canvas ÖУ¬È»ºóºÍ²ÊÉ«µÄͼƬÓà CSS ¶¨Î»ÔÚͬһ¸öλÖ㬲¢ÉèÖà z-index ʹ canvas λÓÚ²ÊɫͼƬ֮ÉÏ¡£µ±°´×¡Êó±ê²¢ÔÚ canvas ÉÏÀ´»ØÒƶ¯Ê±£¬¾Í³öÏÖÁËÀàËÆÏðÆ¤²Á²Á³öµÄЧ¹û¡£
ä¯ÀÀÆ÷¼æÈÝ
![]() |
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|---|
| IE9+ ✔ | Chrome ✔ | Firefox ✔ | Opera ✔ | Safari ✔ |
ʹÓ÷½·¨
1¡¢ÒýÈëÎļþ
<script src="js/jquery.min.js"></script> <script src="js/jquery.eraser.js"></script>
2¡¢HTML
<div class="aseoe">
<img src="images/1.jpg" alt="">
<img id="redux" src="images/2.jpg" alt="">
</div>
3¡¢CSS
* {
margin: 0;
padding: 0;
}
.aseoe {
position: relative;
width: 700px;
height: 438px;
margin: 0 auto;
}
.aseoe img {
position: absolute;
left: 0;
top: 0;
z-index: 1;
}
#redux {
position: absolute;
left: 0;
top: 0;
z-index: 2;
}
4¡¢JavaScript
$(function(){
$('#redux').eraser();
});
ÅäÖÃ
| ÊôÐÔ/·½·¨ | ÀàÐÍ | ĬÈÏÖµ | ˵Ã÷ |
|---|---|---|---|
| size | ÕûÊý | 40 | ÏðÆ¤²Á´óС |
| completeRatio | ¸¡µãÊý | 0.7 | ²Á³ö±ÈÂÊ |
| completeFunction | º¯Êý | null | ÅäºÏ completeRatio ʹÓ㬴ﵽ²Á³ö±ÈÂʺóµÄº¯Êý |
| progressFunction | º¯Êý | null | ²Á³öºóµÄ»Øµ÷º¯Êý£¬Ëû½ÓÊÕÒ»¸ö²ÎÊý£¬Îª²Á³öºóµÄ±ÈÂÊ£¨0.0 – 1.0£© |
| reset | ÖØÖ㬼´»¹Ô³Éδ²Á³öµÄ״̬£¬È磺$(‘#yourImage’).eraser(‘reset’); | ||
| clear | Çå³ý£¬È磺$(‘#yourImage’).eraser(‘clear’); |
±¾Õ¾»¶ÓÈκÎÐÎʽµÄ×ªÔØ£¬µ«ÇëÎñ±Ø×¢Ã÷³ö´¦£¬×ðÖØËûÈËÀͶ¯³É¹û
×ªÔØÇë×¢Ã÷£º ÎÄÕÂ×ªÔØ×Ô£º°®Ë¼×ÊÔ´Íø http://www.aseoe.com/show-79-720-1.html
×ªÔØÇë×¢Ã÷£º ÎÄÕÂ×ªÔØ×Ô£º°®Ë¼×ÊÔ´Íø http://www.aseoe.com/show-79-720-1.html








