Class Index | File Index

Classes


Class Galleria.Picture


Defined in: galleria.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Adds preload, cache, scale and crop functionality
Method Summary
Method Attributes Method Name and Description
 
isCached(src)
Checks if an image is in cache
 
load(src, callback)
Loads an image and call the callback when ready.
 
scale(options)
Scales and crops the image
Class Detail
Galleria.Picture(id)
Adds preload, cache, scale and crop functionality
Parameters:
{Number} id
Optional id to keep track of instances
Requires:
jQuery
Method Detail
{Boolean} isCached(src)
Checks if an image is in cache
Parameters:
{String} src
The image source path, ex '/path/to/img.jpg'
Returns:
{Boolean}

{jQuery} load(src, callback)
Loads an image and call the callback when ready. Will also add the image to cache.
Parameters:
{String} src
The image source path, ex '/path/to/img.jpg'
{Function} callback
The function to be executed when the image is loaded & scaled
Returns:
{jQuery} The image container object

{jQuery} scale(options)
Scales and crops the image
Parameters:
{Object} options
The method takes an object with a number of options:
  • width - width of the container
  • height - height of the container
  • min - minimum scale ratio
  • max - maximum scale ratio
  • margin - distance in pixels from the image border to the container
  • complete - a callback that fires when scaling is complete
  • position - positions the image, works like the css background-image property.
  • crop - defines how to crop. Can be true, false, 'width' or 'height'
Returns:
{jQuery} The image container object