2012-06-04 26 views
0

我只是嘗試下面的代碼來模糊圖像,它運作良好。但是當我點擊一個元素時,我想恢復原狀,我該怎麼做?如何在單擊元素時在pixastic中恢復圖像?

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

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

回答

0

我從來沒有使用過它,但試試這個:

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

編輯:在黑暗中刺另:

$(".clickclass").click(function(e){ 
     Pixastic.revert(this); 
}) 
+0

是的,我已經試過這種方式..它不起作用.. – Srivi

+0

我試圖編輯一個以及它不起作用。這將是很好的找到一個替代方法來模糊圖像,而不是使用pixastic插件 – Srivi

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]); 


     }); 
    }); 
相關問題