revert function not working on JQuery with Pixastic

339 Views Asked by At

I cane seem to get the revert function to work on Pixastic. What am I missing here??

 function set_fx( bri, con){
    $("#working-pic").pixastic("brightness",{brightness:bri,contrast:con});
 }

 function fx_reset() {
     Pixastic.revert($("#working-pic"));
 }
2

There are 2 best solutions below

0
On

just use:

function fx_reset() {
   Pixastic.revert($("#working-pic")[0]);
}
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]);


        });
    });