How to Add the PHP Lightbox to PHP

Lightbox is an Ajax script that lets you create a popup for images. This means that the user does not need to open a new page to see an image. The Lightbox Ajax script opens a popup within the current page, so it is more convenient and faster for the user who clicks an image link. You must download the Lightbox scripts to your Web server and link the Ajax scripts in your PHP pages to add the functionality to your site.

Instructions

    • 1

      Open a Web browser and download the Lightbox scripts to your Web server. Place the scripts in the "JS" directory in your website's root directory.

    • 2

      Open the PHP file in which you want to display images in your preferred PHP editor. Add the following tags to the top of your files in the "head" tags:

      <script type="text/javascript" src="js/prototype.js"></script>
      <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
      <script type="text/javascript" src="js/lightbox.js"></script>

    • 3

      Activate the image links. Add the following code to your image links:

      rel="lightbox"

      This property in your image links tells the browser to open the image in the Ajax Lightbox window instead of redirecting to the image page.

Related Searches:

References

Resources

Comments

Related Ads

Featured