开发者

jquery onload prettyphoto

开发者 https://www.devze.com 2022-12-14 11:57 出处:网络
$(document).ready(function(){ 开发者_如何学Python$(\"a[rel^=\'prettyPhoto\']\").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.

0

精彩评论

暂无评论...
验证码 换一张
取 消