Skip to content
Advertisement

Blur image with JavaScript or jQuery?

Is there any way to blur images with JavaScript/jQuery so that when they are blured I can sharpen them by hovering them with the mouse?

Advertisement

Answer

Pixastic can do that for you. Here’s the relevant doc: http://www.pixastic.com/lib/docs/actions/blur/

To blur:

Pixastic.process(document.getElementById('demoimage'), 'blur');

To revert:

Pixastic.revert(document.getElementById('demoimage'));

The entire solution with jQuery:

var blur = function () {
    Pixastic.process(this, 'blur');
};

var unblur = function () {
    Pixastic.revert(this);
};

$('img').each(blur).hover(unblur, blur);
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement