tags:

views:

347

answers:

2
$(document).ready(function(){
$("a[rel^='prettyPhoto']").prettyPhoto();
});

How do I get this to load onload instead of when clicked?

A: 

You could try:

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

That should trigger a click event on the link after attaching the prettyPhoto events to it. I imagine it'll break if you have more than one prettyPhoto link on the page, though.

ceejayoz
+1  A: 

Looking at the prettyPhoto documentation, you can do any of the following directly in your script.

$.prettyPhoto.open('images/fullscreen/image.jpg','Title','Description');
$.prettyPhoto.changePage('next');
$.prettyPhoto.changePage('previous');
$.prettyPhoto.close();
Shawn Steward
thanks I can't believe I missed that!!
Aaron R