PrettyPhoto be opened automatically when you load a page?
  • I need to show a message to users when they visit my page and would like this message is opened in a PrettyPhoto the start page in the onLoad or otherwise
  • You can achieve this using the prettyPhoto API.

    Upon page load you could call something similar to:

    Full documentation can be found here:
  • that would be within


  • was perfect with a picture, but could do with a text?, as would
  • Did you figure out how to get this to work? As I need to do the same thing. I'd like to put content in to the popup but I can only get images to work, I don't mind if the content has to be put directly into the open call but I'd rather just point it at a div like I can do with the rel="prettyPhoto" non-API way of working, I've read the docs for the API and they aren't any help.
  • Markh - You can do this quite simply with jQuery - If your target has an ID of foo, then simply trigger the click via jQuery:
    Click for text

    javascript in document ready:

    That will essentially trigger a click on the link and thus create the modal window
  • TeckniX yeah that's the solution I have so far, the problem is that because the element has to be a link with rel="prettyPhoto", when the modal window opens all the text within it is considered the link so is underlined and click-able. I either need the open() api call to accept any content, either in the form of a jquery selector or by accepting it as a parameter. Or the higher level method to accept any selector and have some method of opening the window without a click...
  • markh - Sorry for not replying sooner.
    You can trigger a 'div' opening via the open api:

  • Also,

    I'm about to release the new version which support deeplinking. That mean you'll be able to share prettyPhoto links and when people click on them prettyPhoto will open automagically :)
  • Hi,
    when you want to load content other than picture in prettyphoto. Use PrettyPhoto 3.1.3


    then will open in lightbox on page load

    You can also use cookie (jquery.cookie.js) if you want load once every 3 days

    if ($.cookie('cookie_name') != '1') {
    $.cookie('cookie_name', '1', { expires: 3 }); }
  • the popup is conflicting with my flash site. The popup does not "pop up" but is displayed at the bottom of the page as opposed to "covering" the main page.

    Is it the flashobject.js that's conflicting with the prettyPhoto.js or is it just the way I have the coding set up?

    var fo = new FlashObject("flash/main6_v8.swf", "head", "100%", "100%", "10", "");
    fo.addParam("quality", "high");
    fo.addParam("allowFullScreen", "true");



Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter