Search code examples
javascriptjquerypixastic

Pixastic - jQuery plugin not working?


I have a problem with jQuery plugin called Pixastic. I got it working as standalone library, but I cannot use it with jQuery because it does not work, I used code from documentation and still can't get it to work for some reason.

Documentation that I followed: http://www.pixastic.com/lib/docs/#jquery

HTML (I cannot put full HTML page since it won't show it here ?bug?, but just so you are sure that I am including everything allright)

<script src="jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="pixastic.full.js" type="text/javascript"></script>
<script src="f.js" type="text/javascript"></script>
<img id="image" src="014.jpg" />

JS (f.js)

$(document).ready(function()
{
    /*
    Pixastic.process(document.getElementById("image"), "blurfast",
    {
    amount : 3
});
    */

    Pixastic.process(document.getElementById("image"), "desaturate"); // - Works
    //$("#image").pixastic("desaturate"); // - Not so much...
});

Solution

  • From the documentation you linked to:

    When chaining actions, it's especially important that you ensure that the image is fully loaded before calling the pixastic() method, so it might be wise to put the Pixastic code in an onload event or similar.

    It's likely that you need to use $(window).load() rather than $(document).ready(). $("#image").load() might be an even better idea.