Viewing 1 replies (of 1 total)
  • Thread Starter daniish

    (@daniish)

    /**
    		* 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.