Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable prettyPhoto?

I now how to enable prettyphoto, but the problem is how to disable?

Here i enable prettyPhoto

$(document).ready(function(){ $("a[rel^='prettyPhoto']").prettyPhoto({ social_tools:false, }); }); 

How to disable?

like image 403
Miomir Dancevic Avatar asked Oct 11 '13 06:10

Miomir Dancevic


2 Answers

    $("a[rel^='prettyPhoto']").unbind('click');
    $("a[rel^='prettyPhoto']").attr('rel', '');

Just unbind click and rel attribute.

like image 155
BENARD Patrick Avatar answered Nov 14 '22 21:11

BENARD Patrick


Sadly the prettyPhoto does not seem to have a "turnOff" option. If you are not using any other click event handlers for those links, @Yenne Info 's answer is just fine.

If you don't want to unbind all click event handlers:

Looking through the prettyPhoto code - at the end of method definition, you can find something like:

return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize);

So the proper unbind without losing other click-related event handlers would be (generally for all links):

jQuery('a').unbind('click.prettyphoto');

For your specific selector:

$("a[rel^='prettyPhoto']").unbind('click.prettyphoto');
like image 1
jave.web Avatar answered Nov 14 '22 22:11

jave.web