asalute
02-18-2014, 04:15 PM
http://www.technogadge.com/bxgallery-jquery-image-gallery-plugin/ How to get this to work please the creator no longer supports and I'm trying to implement on a web page. code will be in two parts due to character restrictions
/*
bxGallery v1.1
Plugin developed by: Steven Wanderski
http://bxgalleryplugin.com
http://stevenwanderski.com
Released under the GPL license:
http://www.gnu.org/licenses/gpl.html
*/
(function($) {
$.fn.extend({
bxGallery: function(options) {
var defaults = {
maxwidth: '',
maxheight: '',
thumbwidth: 200,
thumbcrop: false,
croppercent: .35,
thumbplacement: 'bottom',
thumbcontainer: '',
opacity: .7,
load_text: '',
load_image: 'http://i302.photobucket.com/albums/nn92/wandoledzep/spinner.gif',
wrapperclass: 'outer'
}
var options = $.extend(defaults, options);
var o = options;
var cont = '';
var caption = '';
var $outer = '';
var $orig = this;
var tall = 0;
var wide = 0;
var showing = 0;
var i = 0;
var k = $orig.find('img')
.size();
var current;
preload_img();
function preload_img() {
$orig.hide();
if (o.load_text != '') {
$orig.before('<div id="loading">' + o.load_text + '</div>');
} else {
$orig.before('<div id="loading"><img src="' + o.load_image + '" /></div>');
}
$orig.parent()
.find('#loading')
.css({
'textAlign': 'center',
'width': o.maxwidth
});
$orig.find('img')
.each(function() {
var the_source = $(this)
.attr('src');
var the_img = new Image();
the_img.onload = function() {
preload_check();
};
the_img.src = the_source;
});
}
function preload_check() {
i++;
if (i == k) {
init();
}
}
function init() {
set_layout();
set_main_img();
place_thumbcontainer();
set_thumbs();
}
function set_layout() {
$orig.parent()
.find('#loading')
.hide();
$orig.show();
$orig.wrap('<div class="' + o.wrapperclass + '"></div>');
$outer = $orig.parent();
$orig.find('li')
.css({
'position': 'absolute'
});
}
function set_main_img() {
$orig.find('img')
.each(function() {
var $this = $(this);
var $imgheight = $this.height();
var $imgwidth = $this.width();
if ($this.attr('title') != '') {
caption = $this.attr('title');
$this.parent()
.append('<div class="caption">' + caption + '</div>');
}
if (o.maxwidth != '') {
if ($this.width() > o.maxwidth) {
$this.width(o.maxwidth);
$this.height(($imgheight / $imgwidth) * o.maxwidth);
}
}
if (o.maxheight != '') {
if ($this.height() > o.maxheight) {
$this.height(o.maxheight);
$this.width(($imgwidth / $imgheight) * o.maxheight);
}
}
if ($this.height() + $this.parent()
.find('.caption')
.height() > tall) {
tall = $this.height() + $this.parent()
.find('.caption')
.height();
}
if ($this.width() > wide) {
wide = $this.width();
}
cont += '<li><img src="' + $this.attr('src') + '" /></li>';
});
$orig.find('li:not(:first)')
.hide();
$orig.height(tall);
$orig.width(wide);
$outer.find('.caption')
.width(wide);
}
/*
bxGallery v1.1
Plugin developed by: Steven Wanderski
http://bxgalleryplugin.com
http://stevenwanderski.com
Released under the GPL license:
http://www.gnu.org/licenses/gpl.html
*/
(function($) {
$.fn.extend({
bxGallery: function(options) {
var defaults = {
maxwidth: '',
maxheight: '',
thumbwidth: 200,
thumbcrop: false,
croppercent: .35,
thumbplacement: 'bottom',
thumbcontainer: '',
opacity: .7,
load_text: '',
load_image: 'http://i302.photobucket.com/albums/nn92/wandoledzep/spinner.gif',
wrapperclass: 'outer'
}
var options = $.extend(defaults, options);
var o = options;
var cont = '';
var caption = '';
var $outer = '';
var $orig = this;
var tall = 0;
var wide = 0;
var showing = 0;
var i = 0;
var k = $orig.find('img')
.size();
var current;
preload_img();
function preload_img() {
$orig.hide();
if (o.load_text != '') {
$orig.before('<div id="loading">' + o.load_text + '</div>');
} else {
$orig.before('<div id="loading"><img src="' + o.load_image + '" /></div>');
}
$orig.parent()
.find('#loading')
.css({
'textAlign': 'center',
'width': o.maxwidth
});
$orig.find('img')
.each(function() {
var the_source = $(this)
.attr('src');
var the_img = new Image();
the_img.onload = function() {
preload_check();
};
the_img.src = the_source;
});
}
function preload_check() {
i++;
if (i == k) {
init();
}
}
function init() {
set_layout();
set_main_img();
place_thumbcontainer();
set_thumbs();
}
function set_layout() {
$orig.parent()
.find('#loading')
.hide();
$orig.show();
$orig.wrap('<div class="' + o.wrapperclass + '"></div>');
$outer = $orig.parent();
$orig.find('li')
.css({
'position': 'absolute'
});
}
function set_main_img() {
$orig.find('img')
.each(function() {
var $this = $(this);
var $imgheight = $this.height();
var $imgwidth = $this.width();
if ($this.attr('title') != '') {
caption = $this.attr('title');
$this.parent()
.append('<div class="caption">' + caption + '</div>');
}
if (o.maxwidth != '') {
if ($this.width() > o.maxwidth) {
$this.width(o.maxwidth);
$this.height(($imgheight / $imgwidth) * o.maxwidth);
}
}
if (o.maxheight != '') {
if ($this.height() > o.maxheight) {
$this.height(o.maxheight);
$this.width(($imgwidth / $imgheight) * o.maxheight);
}
}
if ($this.height() + $this.parent()
.find('.caption')
.height() > tall) {
tall = $this.height() + $this.parent()
.find('.caption')
.height();
}
if ($this.width() > wide) {
wide = $this.width();
}
cont += '<li><img src="' + $this.attr('src') + '" /></li>';
});
$orig.find('li:not(:first)')
.hide();
$orig.height(tall);
$orig.width(wide);
$outer.find('.caption')
.width(wide);
}