Search code examples
javascriptjquerypixastic

Reverting a pixastic effect with jquery


$(function() {
    $( "#slider" ).slider({
      range: "min",
      value: 2,
      min: 0,
      max: 5,
      slide: function( event, ui ) {
        // While sliding update the value
        $( "#image" ).pixastic('blurfast', {amount:ui.value});
       }
    });
    // Set the initial slider amount
    var value = $( "#slider" ).slider( "value" );
    $( "#image" ).pixastic('blurfast', {amount:value});
  });

I've got multiple sliders for pixastic effects on an image. However every time the slider updates the image, I want it to revert the old effect and apply the new level of that effect rather than the effect accumulating each time. I'm aware of the revert function in the pixastic library, but I'm fairly new with jquery and unsure how to use it. How could I go about doing this?


Solution

  • $("#image").click(function(){
       Pixastic.revert(document.getElementById('image'));
       //apply your new effect.
    });