0

我只是尝试使用以下代码来模糊图像,效果很好。但是我想在单击元素时恢复原状,我该怎么做?

$(window).bind("load",function() {

         $(".testclass").pixastic("blurfast", {amount:0.9});
    $(".clickclass").click(function(e){
        // this statement should revert the image
                });
    }
);
4

2 回答 2

0

我从来没有使用过它,但试试这个:

$(".clickclass").click(function(e){
      $(this).pixastic("blurfast", {amount:0}); //This should remove the blur
});

编辑:黑暗中的另一个刺:

$(".clickclass").click(function(e){
      Pixastic.revert(this);
 })
于 2012-06-04T01:24:53.657 回答
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]);


        });
    });
于 2014-02-07T15:07:06.670 回答