Categories

Featured templates

JS Animated. How to implement jQuery “prettyPhoto” lightbox plugin

Norman Fisher December 11, 2013
Rating: 4.0/5. From 5 votes.
Please wait...

This tutorial is going to show you how to implement the jQuery prettyPhoto lightbox plugin into your JS Animated template.

JS Animated. How to implement jQuery “prettyPhoto” lightbox plugin

PrettyPhoto is a jQuery lightbox clone. It supports not only images, but also videos, flash, YouTube, iframes and ajax. It’s a full blown media lightbox.

To add it to your page:
  1. Download prettyPhoto_compressed_3.1.5.zip from http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/  on your computer and unpack it.

    js_animated_jquery_prettyphoto_lightbox_plugin_implementing_1
  2. Copy the js and css folders from the unzipped package and paste them into the site folder of your template package. Since you already have folders with the same names there, you will be asked to replace them. This will just add the files in these folders to them, so just go ahead and agree to the replacement.

    js_animated_jquery_prettyphoto_lightbox_plugin_implementing_2
  3. Open the .html file with the image you want to apply the plugin to and add the libraries and the table of styles to it in DreamWeaver to the <head> section:

    <link rel="stylesheet" href="css/prettyPhoto.css" type="text/css" media="screen" title="prettyPhoto main stylesheet" charset="utf-8" />
    
    <script src="js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script> 
    
    js_animated_jquery_prettyphoto_lightbox_plugin_implementing_3
  4. Find the line with the image, e.g.:

  5. <img src="images/image_small.jpg " alt="" />
      

    And change it to:

        
    <a href="images/image_big.jpg" rel="prettyPhoto" title="Single Photo"><img src="images/image_small.jpg " alt=" " /></a>    
    
    js_animated_jquery_prettyphoto_lightbox_plugin_implementing_4

    In the images folder there should be image_big.jpg and image_small.jpg accordingly.

    js_animated_jquery_prettyphoto_lightbox_plugin_implementing_5
  6. Initialize prettyPhoto: add the following to your .html file right before the closing </head> tag:

  7.       
    <script type="text/javascript" charset="utf-8">
    $(document).ready(function(){
    $("a[rel^='prettyPhoto']").prettyPhoto();
    });
    </script>
    
    js_animated_jquery_prettyphoto_lightbox_plugin_implementing_6
  8. Save the changes and  check your page in a web browser: the image should be opening in a lightbox.
  9. js_animated_jquery_prettyphoto_lightbox_plugin_implementing_7.

For more information on how to use the plugin, please refer to the official manual at http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/documentation.

Feel free to check the detailed video tutorial below:

JS Animated. How to implement jQuery “prettyPhoto” lightbox plugin

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket