jquery onload prettyphoto
$(document).ready(function(){
开发者_如何学Python$("a[rel^='prettyPhoto']").prettyPhoto();
});
How do I get this to load onload instead of when clicked?
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();
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.
Put onLoad="$.prettyPhoto.open('images/fullscreen/image.jpg','Title','Description');"
in the body tag, easy peasy.
精彩评论