RapidWeaver Media Albums with prettyPhoto

language: Other
license: Other

Code for Snippet:

                
// add lightbox/prettyPhoto to albums
var sdLightboxAlbums = (function() {
// test if either album is true
if ($('.album-wrapper').length || $('.movie-thumbnail-frame').length) {
// load css (prettyPhoto)
$("head").append("<link>").children(":last").attr({
rel: "stylesheet",
type: "text/css",
href: RwGet.pathto('css/jquery.prettyPhoto.css')
});
// load js (prettyPhoto)
$.getScript(RwGet.pathto('scripts/jquery.prettyPhoto.js'),
function() {
// once script is loaded
// test if photo album is true
if ($('.album-wrapper').length) {
// get thumbnail links and alter attributes
$('.thumbnail-frame').each(function() {
var thisAnch = $('a', this);
var thisImg = $('a img', this);
var thisCap = $('.thumbnail-caption', this);
thisAnch.attr({
'href': thisImg.attr('src').replace(/thumb/i, 'full'),
'rel': 'prettyPhoto[gallery]',
'title': thisCap.text()
});
});
} else {
// since photo album is false movie album is true
// get thumbnails links and alter attributes
$('.movie-thumbnail-frame').each(function() {
var thisAnch = $('a', this);
var thisCap = $('.movie-thumbnail-caption', this);
var thisPage = thisAnch.attr('href');
thisAnch.removeAttr('onclick').removeAttr('onkeypress').attr({
'href': thisPage + '?iframe=true&width=75%&height=75%',
'rel': 'prettyPhoto[iframes]',
'title': thisCap.text()
});
});
}
// apply effects (prettyPhoto)
$('a[rel^=prettyPhoto]').prettyPhoto({
animation_speed: 'fast',
show_title: false,
theme: 'light_square'
});
});
}
})();
comments powered by Disqus

Info

Source Site:

http://www.codecollector.net/view/codecollector://AE1DCA9A-5194-42AF-AAC9-9AEBB57298AE-272-0000046CAA5E5005

Tags: prettyPhoto lightbox rapidweaver photo album Movie Album

Link to this snippet:


Download to Code Collector

To use the direct link to your snippet on CodeCollector.net either copy the html from the above section or drag the Download to Code Collector to where you would like to use it.

More Info:

Times Viewed: 986
Date Added: 2013-08-06 20:38:37
Last Modified: 2013-08-08 10:43:33

Web Analytics