Title: Javascript initialisation function
Last modified: August 30, 2016

---

# Javascript initialisation function

 *  Resolved [daniish](https://wordpress.org/support/users/daniish/)
 * (@daniish)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/javascript-initialisation-function/)
 * Hello,
 * I am using prettyPhoto with the WPPA+ plugin and have found that it is not displaying
   properly.
 * I contacted WPPA+ and they asked: “is there a Javascript initialisation function
   in this plugin”?
 * Does anyone know what it is?
 * You can see the original thread here:
    [https://wordpress.org/support/topic/prettyphoto-lightbox-grid-layout?replies=20](https://wordpress.org/support/topic/prettyphoto-lightbox-grid-layout?replies=20)
 * Many thanks
 * [https://wordpress.org/plugins/prettyphoto/](https://wordpress.org/plugins/prettyphoto/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [daniish](https://wordpress.org/support/users/daniish/)
 * (@daniish)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/javascript-initialisation-function/#post-6244210)
 *     ```
       /**
       		* Initialize prettyPhoto.
       		*/
       		$.prettyPhoto.initialize = function() {
   
       			settings = pp_settings;
   
       			if(settings.theme == 'pp_default') settings.horizontal_padding = 16;
   
       			// Find out if the picture is part of a set
       			theRel = $(this).attr(settings.hook);
       			galleryRegExp = /\[(?:.*)\]/;
       			isSet = (galleryRegExp.exec(theRel)) ? true : false;
   
       			// Put the SRCs, TITLEs, ALTs into an array.
       			pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return $(n).attr('href'); }) : $.makeArray($(this).attr('href'));
       			pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : ""; }) : $.makeArray($(this).find('img').attr('alt'));
       			pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).attr('title')) ? $(n).attr('title') : ""; }) : $.makeArray($(this).attr('title'));
   
       			if(pp_images.length > settings.overlay_gallery_max) settings.overlay_gallery = false;
   
       			set_position = jQuery.inArray($(this).attr('href'), pp_images); // Define where in the array the clicked item is positionned
       			rel_index = (isSet) ? set_position : $("a["+settings.hook+"^='"+theRel+"']").index($(this));
   
       			_build_overlay(this); // Build the overlay {this} being the caller
   
       			if(settings.allow_resize)
       				$(window).bind('scroll.prettyphoto',function(){ _center_overlay(); });
   
       			$.prettyPhoto.open();
   
       			return false;
       		}
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Javascript initialisation function’ is closed to new replies.

 * ![](https://ps.w.org/prettyphoto/assets/icon-256x256.png?rev=2331751)
 * [PrettyPhoto - Simple Lightbox Plugin](https://wordpress.org/plugins/prettyphoto/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/prettyphoto/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/prettyphoto/)
 * [Active Topics](https://wordpress.org/support/plugin/prettyphoto/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/prettyphoto/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/prettyphoto/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 1 reply
 * 1 participant
 * Last reply from: [daniish](https://wordpress.org/support/users/daniish/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/javascript-initialisation-function/#post-6244210)
 * Status: resolved