How to revert an image in pixastic when an element is clicked?

762 Views Asked by At

I just tried following code to blur an image , it works well. But i want to revert back when an element is clicked, how can I do this ?

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

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

There are 2 best solutions below

1
On

I've never used it, but give this a try:

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

EDIT: Another stab in the dark:

$(".clickclass").click(function(e){
      Pixastic.revert(this);
 })
0
On
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]);


        });
    });