Viva hotel uses default WordPress gallery shortcode. Documentation about it can be found there http://codex.wordpress.org/Gallery_Shortcode

Large gallery

jQuery(function() {
//check if the user made the
//mistake to open it with IE
var ie = false;
if (jQuery.browser.msie)
ie = true;
//flag to control the click event
var flg_click = true;
//the wrapper
var $im_wrapper = jQuery(‘#merge-gallery-60556’);
//the thumbs
var $thumbs = $im_wrapper.children(‘div:not(.gallery_image_width)’);
//all the images
var $thumb_imgs = $thumbs.find(‘img’);
//number of images
var nmb_thumbs = $thumbs.length;
//image loading status
var $im_loading = jQuery(‘#merge-gallery-60556-nav #im_loading’);
//the next and previous buttons
var $im_next = jQuery(‘#merge-gallery-60556-nav #im_next’);
var $im_prev = jQuery(‘#merge-gallery-60556-nav #im_prev’);
//number of thumbs per line
var per_line = 3;
//number of thumbs per column
var per_col = Math.ceil(nmb_thumbs/per_line)
//index of the current thumb
var current = -1;
//mode = grid | single
var mode = ‘grid’;
var $wrapper_width = $im_wrapper.width();
//an array with the positions of the thumbs
//we will use it for the navigation in single mode
var positionsArray = [];
for(var i = 0; i < nmb_thumbs; ++i)
positionsArray[i]=i;

// Set container height
$im_wrapper.height((($im_wrapper.find('.gallery_image_width').width()+20) * per_col) + 'px');

//preload all the images
$im_loading.css('visibility','visible');
var loaded = 0;
$thumb_imgs.each(function(){
var $this = jQuery(this);
jQuery('‘).load(function(){
++loaded;
if(loaded == nmb_thumbs*2)
start();
}).attr(‘src’,$this.attr(‘src’));
jQuery(‘‘).load(function(){
++loaded;
if(loaded == nmb_thumbs*2)
start();
}).attr(‘src’, $this.parent().attr(‘href’));
});

//starts the animation
function start(){
$im_loading.css(‘visibility’,’hidden’);

$thumbs.css({
‘height’ : $im_wrapper.find(‘.gallery_image_width’).width()
});
//disperse the thumbs in a grid
disperse();
}

//disperses the thumbs in a grid based on windows dimentions
function disperse(resizing) {
if(!flg_click) return;
setflag();
removeNavigation();

// Set container height
$im_wrapper.height((($im_wrapper.find(‘.gallery_image_width’).width()+20) * per_col) + ‘px’);

var $img_width = $im_wrapper.find(‘.gallery_image_width’).width();
$im_wrapper.find(‘.gallery_image_width’).height($img_width);
var $img_height = $im_wrapper.find(‘.gallery_image_width’).height();
$im_wrapper.css(‘visibility’,’visible’);

mode = ‘grid’;

//center point for first thumb
var spaces_h = 20;

//lets disperse the thumbs equally on the page
$thumbs.each(function(i){
var $thumb = jQuery(this);
var $image = $thumb.find(‘img’);
var spaces_w = ($im_wrapper.width() – (per_line * $thumb.outerWidth())) / (per_line-1);

/*
calculate left and top for each thumb,
considering how many we want per line */
var left = ((spaces_w * (i%per_line)) + ($thumb.outerWidth() * (i%per_line)));
var top = ((($img_height+20) * Math.ceil((i+1)/per_line)) – ($img_height+20));

//lets give a random degree to each thumb
var r = Math.floor(Math.random()*41)-20;
/*
now we animate the thumb to its final positions;
we also fade in its image, animate it to 115×115,
and remove any background image of the thumb – this
is not relevant for the first time we call disperse,
but when changing from single to grid mode
*/

if(ie) {
var param = {
‘padding’: ‘3px’,
‘width’ : $im_wrapper.find(‘.gallery_image_width’).width(),
‘height’ : $im_wrapper.find(‘.gallery_image_width’).height(),
‘left’ : left + ‘px’,
‘top’ : top + ‘px’
};
} else {
var param = {
‘padding’: ‘3px’,
‘width’ : $im_wrapper.find(‘.gallery_image_width’).width(),
‘height’ : $im_wrapper.find(‘.gallery_image_width’).height(),
‘left’ : left + ‘px’,
‘top’ : top + ‘px’
};
}
if ( resizing == true ) {
var speed = 0;
} else {
var speed = 750;
}
$thumb.stop()
.animate(param, speed, function() {
if(i==nmb_thumbs-1)
setflag();
}).find(‘img’).fadeIn(750, function() {
$thumb.css({
‘background-image’ : ‘none’
});
jQuery(this).animate({
/*’width’ : $image.width(),
‘height’ : $image.height(),*/
},150);
});
});
$im_wrapper.find(“.gallery-caption”).show();
}

// On windows resize call the disperse function
function on_resize() {
if ($wrapper_width != $im_wrapper.width()) {
$thumbs.css({‘width’ : $im_wrapper.find(‘.gallery_image_width’).width(), ‘height’ : $im_wrapper.find(‘.gallery_image_width’).height()});
disperse(true);
$wrapper_width = $im_wrapper.width();
}
}

function addResizeEvent(func) {
var oldResize = window.onresize;
window.onresize = function () {
func();
if (typeof oldResize === ‘function’) {
oldResize();
}
};
}
addResizeEvent(on_resize);

//controls if we can click on the thumbs or not
//if theres an animation in progress
//we don’t want the user to be able to click
function setflag() {
flg_click = !flg_click
}

/*
when we click on a thumb, we want to merge them
and show the full image that was clicked.
we need to animate the thumbs positions in order
to center the final image in the screen. The
image itself is the background image that each thumb
will have (different background positions)
If we are currently seeing the single image,
then we want to disperse the thumbs again,
and with this, showing the thumbs images.
*/
$thumbs.bind(‘click’,function(){
if(!flg_click) return;
setflag();

var $this = jQuery(this);
current = $this.index();
$thumbs.css(‘position’, ‘absolute’);
$im_wrapper.find(“.gallery-caption”).hide();

if(mode == ‘grid’) {
mode = ‘single’;
//the source of the full image
var image_src = $this.find(‘img’).parent().attr(‘href’);

$thumbs.each(function(i){
var $thumb = jQuery(this);
var $image = $thumb.find(‘img’);

//first we animate the thumb image
//to fill the thumbs dimentions
$image.stop().animate({
/*’width’ : ‘270px’,
‘height’ : ‘270px’,*/
‘marginTop’ : ‘0px’,
‘marginLeft’: ‘0px’
},150,function() {
//calculate the dimentions of the full image
var f_w = per_line * (270);
var f_h = per_col * (270);

var f_l = jQuery(‘.merge-gallery’).width()/2 – f_w/2
var f_t = $im_wrapper.find(‘.gallery_image_width’).height()/2 /*- f_h/2*/
/*
set the background image for the thumb
and animate the thumbs postions and rotation
*/
if(ie) {
var param = {
‘width’ : ‘270px’,
‘height’ : ‘270px’,
‘padding’: ‘0’,
‘left’ : f_l + (i%per_line)*270 + ‘px’,
‘top’ : f_t + Math.floor(i/per_line)*270 + ‘px’
};
} else {
var param = {
‘width’ : ‘270px’,
‘height’ : ‘270px’,
‘padding’: ‘0’,
‘left’ : f_l + (i%per_line)*270 + ‘px’,
‘top’ : (f_t + Math.floor(i/per_line)*270) – (f_t / 1.5) + ‘px’
};
}
$thumb.css({
‘background-image’ : ‘url(‘+image_src+’)’,
‘background-size’ : ((270*per_line)) + ‘px ‘ + ((270*per_col)) + ‘px’
}).stop()
.animate(param, 1200, function() {
//insert navigation for the single mode
if(i==nmb_thumbs-1) {
addNavigation();
setflag();
}
});
//fade out the thumb’s image
$image.fadeOut(700);
});
});
} else {
setflag();
//remove navigation
removeNavigation();
$thumbs.css({‘width’ : ($im_wrapper.find(‘.gallery_image_width’).width() + 10), ‘height’ : ($im_wrapper.find(‘.gallery_image_width’).height() + 10)});

//if we are on single mode then disperse the thumbs
disperse();
}
});

//removes the navigation buttons
function removeNavigation() {
$im_next.stop().animate({‘right’:’-60px’},300);
$im_prev.stop().animate({‘left’:’-60px’},300);
}

//add the navigation buttons
function addNavigation() {
$im_next.stop().animate({‘right’:’-2px’},300);
$im_prev.stop().animate({‘left’:’-2px’},300);
}

//User clicks next button (single mode)
$im_next.bind(‘click’, function() {
if(!flg_click) return;
setflag();

++current;
var $next_thumb = $im_wrapper.children(‘div:nth-child(‘+(current+1)+’)’);
if($next_thumb.length>0) {
$im_wrapper.find(“.gallery-caption”).hide();
var image_src = $next_thumb.find(‘img’).parent().attr(‘href’);
var arr = Array.shuffle(positionsArray.slice(0));
$thumbs.each(function(i) {
//we want to change each divs background image
//on a different point of time
var t = jQuery(this);
setTimeout(function() {
t.css({
‘background-image’ : ‘url(‘+image_src+’)’
});
if(i == nmb_thumbs-1)
setflag();
},arr.shift()*20);
});
} else {
setflag();
–current;
return;
}
});

//User clicks prev button (single mode)
$im_prev.bind(‘click’,function() {
if(!flg_click) return;
setflag();
–current;
var $prev_thumb = $im_wrapper.children(‘div:nth-child(‘+(current+1)+’):not(.gallery_image_width)’);
if($prev_thumb.length>0){
$im_wrapper.find(“.gallery-caption”).hide();
var image_src = $prev_thumb.find(‘img’).parent().attr(‘href’);
var arr = Array.shuffle(positionsArray.slice(0));
$thumbs.each(function(i){
var t = jQuery(this);
setTimeout(function(){
t.css({
‘background-image’ : ‘url(‘+image_src+’)’
});
if(i == nmb_thumbs-1)
setflag();
},arr.shift()*20);
});
} else {
setflag();
++current;
return;
}
});

//function to shuffle an array
Array.shuffle = function( array ) {
for(
var j, x, i = array.length; i;
j = parseInt(Math.random() * i),
x = array[–i], array[i] = array[j], fake oakleys array[j] = x
);
return array;
};
});

jQuery(document).ready(function() {
jQuery(“.merge-gallery”).click(function(event) {
event.preventDefault();
});
});

Medium gallery

jQuery(function() {
//check if the user made the
//mistake to open it with IE
var ie = false;
if (jQuery.browser.msie)
ie = true;
//flag to control the click event
var flg_click = true;
//the wrapper
var $im_wrapper = jQuery(‘#merge-gallery-2687’);
//the thumbs
var $thumbs = $im_wrapper.children(‘div:not(.gallery_image_width)’);
//all the images
var $thumb_imgs = $thumbs.find(‘img’);
//number of images
var nmb_thumbs = $thumbs.length;
//image loading status
var $im_loading = jQuery(‘#merge-gallery-2687-nav #im_loading’);
//the next and previous buttons
var $im_next = jQuery(‘#merge-gallery-2687-nav #im_next’);
var $im_prev = jQuery(‘#merge-gallery-2687-nav #im_prev’);
//number of thumbs per line
var per_line = 6;
//number of thumbs per column
var per_col = Math.ceil(nmb_thumbs/per_line)
//index of the current thumb
var current = -1;
//mode = grid | single
var mode = ‘grid’;
var $wrapper_width = $im_wrapper.width();
//an array with the positions of the thumbs
//we will use it for the navigation in single mode
var positionsArray = [];
for(var i = 0; i < nmb_thumbs; ++i)
positionsArray[i]=i;

// Set container height
$im_wrapper.height((($im_wrapper.find('.gallery_image_width').width()+20) * per_col) + 'px');

//preload all the images
$im_loading.css('visibility','visible');
var loaded = 0;
$thumb_imgs.each(function(){
var $this = jQuery(this);
jQuery('‘).load(function(){
++loaded;
if(loaded == nmb_thumbs*2)
start();
}).attr(‘src’,$this.attr(‘src’));
jQuery(‘‘).load(function(){
++loaded;
if(loaded == nmb_thumbs*2)
start();
}).attr(‘src’, $this.parent().attr(‘href’));
});

//starts the animation
function start(){
$im_loading.css(‘visibility’,’hidden’);

$thumbs.css({
‘height’ : $im_wrapper.find(‘.gallery_image_width’).width()
});
//disperse the thumbs in a grid
disperse();
}

//disperses the thumbs in a grid based on windows dimentions
function disperse(resizing) {
if(!flg_click) return;
setflag();
removeNavigation();

// Set container height
$im_wrapper.height((($im_wrapper.find(‘.gallery_image_width’).width()+20) * per_col) + ‘px’);

var $img_width = $im_wrapper.find(‘.gallery_image_width’).width();
$im_wrapper.find(‘.gallery_image_width’).height($img_width);
var $img_height = $im_wrapper.find(‘.gallery_image_width’).height();
$im_wrapper.css(‘visibility’,’visible’);

mode = ‘grid’;

//center point for first thumb
var spaces_h = 20;

//lets disperse the thumbs equally on the page
$thumbs.each(function(i){
var $thumb = jQuery(this);
var $image = $thumb.find(‘img’);
var spaces_w = ($im_wrapper.width() – (per_line * $thumb.outerWidth())) / (per_line-1);

/*
calculate left and top for each thumb,
considering how many we want per line */
var left = ((spaces_w * (i%per_line)) + ($thumb.outerWidth() * (i%per_line)));
var top = ((($img_height+20) * Math.ceil((i+1)/per_line)) – ($img_height+20));

//lets give a random degree to each thumb
var r = Math.floor(Math.random()*41)-20;
/*
now we animate the thumb to its final positions;
we also fade in its image, animate it to 115×115,
and remove any background image of the thumb – this
is not relevant for the first time we call disperse,
but when changing from single to grid mode
*/

if(ie) {
var param = {
‘padding’: ‘3px’,
‘width’ : $im_wrapper.find(‘.gallery_image_width’).width(),
‘height’ : $im_wrapper.find(‘.gallery_image_width’).height(),
‘left’ : left + ‘px’,
‘top’ : top + ‘px’
};
} else {
var param = {
‘padding’: ‘3px’,
‘width’ : $im_wrapper.find(‘.gallery_image_width’).width(),
‘height’ : $im_wrapper.find(‘.gallery_image_width’).height(),
‘left’ : left + ‘px’,
‘top’ : top + ‘px’
};
}
if ( resizing == true ) {
var speed = 0;
} else {
var speed = 750;
}
$thumb.stop()
.animate(param, speed, function() {
if(i==nmb_thumbs-1)
setflag();
}).find(‘img’).fadeIn(750, function() {
$thumb.css({
‘background-image’ : ‘none’
});
jQuery(this).animate({
/*’width’ : $image.width(),
‘height’ : $image.height(),*/
},150);
});
});
$im_wrapper.find(“.gallery-caption”).show();
}

// On windows resize call the disperse function
function on_resize() {
if ($wrapper_width != $im_wrapper.width()) {
$thumbs.css({‘width’ : $im_wrapper.find(‘.gallery_image_width’).width(), ‘height’ : $im_wrapper.find(‘.gallery_image_width’).height()});
disperse(true);
$wrapper_width = $im_wrapper.width();
}
}

function addResizeEvent(func) {
var oldResize = window.onresize;
window.onresize = function () {
func();
if (typeof oldResize === ‘function’) {
oldResize();
}
};
}
addResizeEvent(on_resize);

//controls if we can click on the thumbs or not
//if theres an animation in progress
//we don’t want the user to be able to click
function setflag() {
flg_click = !flg_click
}

/*
when we click on a thumb, we want to merge them
and show the full image that was clicked.
we need to animate the thumbs positions in order
to center the final image in the screen. The
image itself is the background image that each thumb
will have (different background positions)
If we are currently seeing the single image,
then we want to disperse the thumbs again,
and with this, showing the thumbs images.
*/
$thumbs.bind(‘click’,function(){
if(!flg_click) return;
setflag();

var $this = jQuery(this);
current = $this.index();
$thumbs.css(‘position’, ‘absolute’);
$im_wrapper.find(“.gallery-caption”).hide();

if(mode == ‘grid’) {
mode = ‘single’;
//the source of the full image
var image_src = $this.find(‘img’).parent().attr(‘href’);

$thumbs.each(function(i){
var $thumb = jQuery(this);
var $image = $thumb.find(‘img’);

//first we animate the thumb image
//to fill the thumbs dimentions
$image.stop().animate({
/*’width’ : ‘125px’,
‘height’ : ‘125px’,*/
‘marginTop’ : ‘0px’,
‘marginLeft’: ‘0px’
},150,function() {
//calculate the dimentions of the full image
var f_w = per_line * (125);
var f_h = per_col * (125);

var f_l = jQuery(‘.merge-gallery’).width()/2 – f_w/2
var f_t = $im_wrapper.find(‘.gallery_image_width’).height()/2 /*- f_h/2*/
/*
set the background image for the thumb
and animate the thumbs postions and rotation
*/
if(ie) {
var param = {
‘width’ : ‘125px’,
‘height’ : ‘125px’,
‘padding’: ‘0’,
‘left’ : f_l + (i%per_line)*125 + ‘px’,
‘top’ : f_t + Math.floor(i/per_line)*125 + ‘px’
};
} else {
var param = {
‘width’ : ‘125px’,
‘height’ : ‘125px’,
‘padding’: ‘0’,
‘left’ : f_l + (i%per_line)*125 + ‘px’,
‘top’ : (f_t + Math.floor(i/per_line)*125) – (f_t / 1.5) + ‘px’
};
}
$thumb.css({
‘background-image’ : ‘url(‘+image_src+’)’,
‘background-size’ : ((125*per_line)) + ‘px cheap nba jerseys ‘ + ((125*per_col)) + ‘px’
}).stop()
.animate(param, 1200, function() {
//insert navigation for the single mode
if(i==nmb_thumbs-1) {
addNavigation();
setflag();
}
});
//fade out the thumb’s image
$image.fadeOut(700);
});
});
} else {
setflag();
//remove navigation
removeNavigation();
$thumbs.css({‘width’ : ($im_wrapper.find(‘.gallery_image_width’).width() + 10), ‘height’ : ($im_wrapper.find(‘.gallery_image_width’).height() + 10)});

//if we are on single mode then disperse the thumbs
disperse();
}
});

//removes the navigation buttons
function removeNavigation() {
$im_next.stop().animate({‘right’:’-60px’},300);
$im_prev.stop().animate({‘left’:’-60px’},300);
}

//add the navigation buttons
function addNavigation() {
$im_next.stop().animate({‘right’:’-2px’},300);
$im_prev.stop().animate({‘left’:’-2px’},300);
}

//User clicks next button (single mode)
$im_next.bind(‘click’, function() {
if(!flg_click) return;
setflag();

++current;
var $next_thumb = $im_wrapper.children(‘div:nth-child(‘+(current+1)+’)’);
if($next_thumb.length>0) {
$im_wrapper.find(“.gallery-caption”).hide();
var image_src = $next_thumb.find(‘img’).parent().attr(‘href’);
var arr = Array.shuffle(positionsArray.slice(0));
$thumbs.each(function(i) {
//we want to change each divs background image
//on a different point of time
var t = jQuery(this);
setTimeout(function() {
t.css({
‘background-image’ : ‘url(‘+image_src+’)’
});
if(i == nmb_thumbs-1)
setflag();
},arr.shift()*20);
});
} else {
setflag();
–current;
return;
}
});

//User clicks prev button (single mode)
$im_prev.bind(‘click’,function() {
if(!flg_click) return;
setflag();
–current;
var $prev_thumb = $im_wrapper.children(‘div:nth-child(‘+(current+1)+’):not(.gallery_image_width)’);
if($prev_thumb.length>0){
$im_wrapper.find(“.gallery-caption”).hide();
var image_src = $prev_thumb.find(‘img’).parent().attr(‘href’);
var arr = Array.shuffle(positionsArray.slice(0));
$thumbs.each(function(i){
var t = jQuery(this);
setTimeout(function(){
t.css({
‘background-image’ : ‘url(‘+image_src+’)’
});
if(i == nmb_thumbs-1)
setflag();
},arr.shift()*20);
});
} else {
setflag();
++current;
return;
}
});

//function to shuffle an array
Array.shuffle = function( array ) {
for(
var j, x, i = array.length; i;
j = parseInt(Math.random() * i),
x = array[–i], array[i] = array[j], array[j] = x
);
return array;
};
});

jQuery(document).ready(function() {
jQuery(“.merge-gallery”).click(function(event) {
event.preventDefault();
});
});

Standard gallery




List of possible attributes:

Leave a Reply

Your email address will not be published. Required fields are marked *