我刚尝试使用代码来模糊图像,效果很好。但是我想在单击元素时还原,我该怎么做?
$(window).bind("load",function() {
$(".testclass").pixastic("blurfast", {amount:0.9});
$(".clickclass").click(function(e){
// this statement should revert the image
});
}
);
答案 0 :(得分:0)
我从未使用它,但尝试一下:
$(".clickclass").click(function(e){
$(this).pixastic("blurfast", {amount:0}); //This should remove the blur
});
编辑:在黑暗中再次刺伤:
$(".clickclass").click(function(e){
Pixastic.revert(this);
})
答案 1 :(得分:0)
adding [0] made a big difference. Definitely did the trick for me. Give it a try
Pixastic.revert($(this).find('.imageUrl')[0]);
Another thing is i had to create a VAR as pixastic creates a duplicate canvas
This is my whole function
$(function () {
$('.col1.w1').mouseenter(function () {
var origImg = ($(this).find('.imageUrl'));
if (origImg.is('img')) {
Pixastic.process(origImg[0], 'blurfast', { amount: 2 });
}
});
$('.col1.w1').mouseout(function () {
var origImg = ($(this).find('.imageUrl'));
Pixastic.revert($(this).find('.imageUrl')[0]);
});
});