// camera slideshow v1.3.4 - a jquery slideshow with many effects, transitions, easy to customize, using canvas and mobile ready, based on jquery 1.4+
// copyright (c) 2012 by manuel masia - www.pixedelic.com
// licensed under the mit license: http://www.opensource.org/licenses/mit-license.php
;(function($){$.fn.camera = function(opts, callback) {
var defaults = {
alignment : 'center', //topleft, topcenter, topright, centerleft, center, centerright, bottomleft, bottomcenter, bottomright
autoadvance : true, //true, false
mobileautoadvance : true, //true, false. auto-advancing for mobile devices
bardirection : 'lefttoright', //'lefttoright', 'righttoleft', 'toptobottom', 'bottomtotop'
barposition : 'bottom', //'bottom', 'left', 'top', 'right'
cols : 6,
easing : 'easeinoutexpo', //for the complete list http://jqueryui.com/demos/effect/easing.html
mobileeasing : '', //leave empty if you want to display the same easing on mobile devices and on desktop etc.
fx : 'random', //'random','simplefade', 'curtaintopleft', 'curtaintopright', 'curtainbottomleft', 'curtainbottomright', 'curtainsliceleft', 'curtainsliceright', 'blindcurtaintopleft', 'blindcurtaintopright', 'blindcurtainbottomleft', 'blindcurtainbottomright', 'blindcurtainslicebottom', 'blindcurtainslicetop', 'stampede', 'mosaic', 'mosaicreverse', 'mosaicrandom', 'mosaicspiral', 'mosaicspiralreverse', 'topleftbottomright', 'bottomrighttopleft', 'bottomlefttopright', 'bottomlefttopright'
//you can also use more than one effect, just separate them with commas: 'simplefade, scrollright, scrollbottom'
mobilefx : '', //leave empty if you want to display the same effect on mobile devices and on desktop etc.
griddifference : 250, //to make the grid blocks slower than the slices, this value must be smaller than transperiod
height : '50%', //here you can type pixels (for instance '300px'), a percentage (relative to the width of the slideshow, for instance '50%') or 'auto'
imagepath : 'images/', //he path to the image folder (it serves for the blank.gif, when you want to display videos)
hover : true, //true, false. puase on state hover. not available for mobile devices
loader : 'pie', //pie, bar, none (even if you choose "pie", old browsers like ie8- can't display it... they will display always a loading bar)
loadercolor : '#eeeeee',
loaderbgcolor : '#222222',
loaderopacity : .8, //0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1
loaderpadding : 2, //how many empty pixels you want to display between the loader and its background
loaderstroke : 7, //the thickness both of the pie loader and of the bar loader. remember: for the pie, the loader thickness must be less than a half of the pie diameter
minheight : '200px', //you can also leave it blank
navigation : true, //true or false, to display or not the navigation buttons
navigationhover : true, //if true the navigation button (prev, next and play/stop buttons) will be visible on hover state only, if false they will be visible always
mobilenavhover : true, //same as above, but only for mobile devices
opacityongrid : false, //true, false. decide to apply a fade effect to blocks and slices: if your slideshow is fullscreen or simply big, i recommend to set it false to have a smoother effect
overlayer : true, //a layer on the images to prevent the users grab them simply by clicking the right button of their mouse (.camera_overlayer)
pagination : true,
playpause : true, //true or false, to display or not the play/pause buttons
pauseonclick : true, //true, false. it stops the slideshow when you click the sliders.
piediameter : 38,
pieposition : 'righttop', //'righttop', 'lefttop', 'leftbottom', 'rightbottom'
portrait : false, //true, false. select true if you don't want that your images are cropped
rows : 4,
slicedcols : 12, //if 0 the same value of cols
slicedrows : 8, //if 0 the same value of rows
slideon : 'random', //next, prev, random: decide if the transition effect will be applied to the current (prev) or the next slide
thumbnails : false,
time : 7000, //milliseconds between the end of the sliding effect and the start of the nex one
transperiod : 1500, //lenght of the sliding effect in milliseconds
////////callbacks
onendtransition : function() { }, //this callback is invoked when the transition effect ends
onloaded : function() { }, //this callback is invoked when the image on a slide has completely loaded
onstartloading : function() { }, //this callback is invoked when the image on a slide start loading
onstarttransition : function() { } //this callback is invoked when the transition effect starts
};
function ismobile() {
if( navigator.useragent.match(/android/i) ||
navigator.useragent.match(/webos/i) ||
navigator.useragent.match(/ipad/i) ||
navigator.useragent.match(/iphone/i) ||
navigator.useragent.match(/ipod/i)
){
return true;
}
}
var opts = $.extend({}, defaults, opts);
var wrap = $(this).addclass('camera_wrap');
wrap.wrapinner(
'
'
).wrapinner(
''
);
var fakehover = $('.camera_fakehover',wrap);
fakehover.append(
''
);
if(opts.overlayer == true){
fakehover.append(
''
)
}
fakehover.append(
''
);
var loader;
if(opts.loader=='pie' && $.browser.msie && $.browser.version < 9){
loader = 'bar';
} else {
loader = opts.loader;
}
if(loader == 'pie'){
fakehover.append(
''
)
} else if (loader == 'bar') {
fakehover.append(
''
)
} else {
fakehover.append(
''
)
}
if(opts.playpause==true){
fakehover.append(
''
)
}
if(opts.navigation==true){
fakehover.append(
'
'
).append(
'
'
);
}
if(opts.thumbnails==true){
wrap.append(
''
);
}
if(opts.thumbnails==true && opts.pagination!=true){
$('.camera_thumbs_cont',wrap).wrap(
''
).wrap(
''
).wrap(
''
).wrap(
''
);
}
if(opts.pagination==true){
wrap.append(
''
);
}
wrap.append(
''
);
$('.camera_caption',wrap).each(function(){
$(this).wrapinner('');
});
var pieid = 'pie_'+wrap.index(),
elem = $('.camera_src',wrap),
target = $('.camera_target',wrap),
content = $('.camera_target_content',wrap),
piecontainer = $('.camera_pie',wrap),
barcontainer = $('.camera_bar',wrap),
prevnav = $('.camera_prev',wrap),
nextnav = $('.camera_next',wrap),
commands = $('.camera_commands',wrap),
pagination = $('.camera_pag',wrap),
thumbs = $('.camera_thumbs_cont',wrap);
var w,
h;
var allimg = new array();
$('> div', elem).each( function() {
allimg.push($(this).attr('data-src'));
});
var alllinks = new array();
$('> div', elem).each( function() {
if($(this).attr('data-link')){
alllinks.push($(this).attr('data-link'));
} else {
alllinks.push('');
}
});
var alltargets = new array();
$('> div', elem).each( function() {
if($(this).attr('data-target')){
alltargets.push($(this).attr('data-target'));
} else {
alltargets.push('');
}
});
var allpor = new array();
$('> div', elem).each( function() {
if($(this).attr('data-portrait')){
allpor.push($(this).attr('data-portrait'));
} else {
allpor.push('');
}
});
var allalign= new array();
$('> div', elem).each( function() {
if($(this).attr('data-alignment')){
allalign.push($(this).attr('data-alignment'));
} else {
allalign.push('');
}
});
var allthumbs = new array();
$('> div', elem).each( function() {
if($(this).attr('data-thumb')){
allthumbs.push($(this).attr('data-thumb'));
} else {
allthumbs.push('');
}
});
var amountslide = allimg.length;
$(content).append('');
var loopmove;
for (loopmove=0;loopmove');
if(alllinks[loopmove]!=''){
//only for wordpress plugin
var databox = $('> div ',elem).eq(loopmove).attr('data-box');
if(typeof databox !== 'undefined' && databox !== false && databox != '') {
databox = 'data-box="'+$('> div ',elem).eq(loopmove).attr('data-box')+'"';
} else {
databox = '';
}
//
$('.camera_target_content .cameracontent:eq('+loopmove+')',wrap).append('');
}
}
$('.camera_caption',wrap).each(function(){
var ind = $(this).parent().index(),
cont = wrap.find('.cameracontent').eq(ind);
$(this).appendto(cont);
});
target.append('');
var cameracont = $('.cameracont',wrap);
var loop;
for (loop=0;loop');
var div = $('> div:eq('+loop+')',elem);
target.find('.cameraslide_'+loop).clone(div);
}
function thumbnailvisible() {
var wth = $(thumbs).width();
$('li', thumbs).removeclass('camera_visthumb');
$('li', thumbs).each(function(){
var pos = $(this).position(),
ulw = $('ul', thumbs).outerwidth(),
offul = $('ul', thumbs).offset().left,
offdiv = $('> div',thumbs).offset().left,
ulleft = offdiv-offul;
if(ulleft>0){
$('.camera_prevthumbs',camera_thumbs_wrap).removeclass('hidenav');
} else {
$('.camera_prevthumbs',camera_thumbs_wrap).addclass('hidenav');
}
if((ulw-ulleft)>wth){
$('.camera_nextthumbs',camera_thumbs_wrap).removeclass('hidenav');
} else {
$('.camera_nextthumbs',camera_thumbs_wrap).addclass('hidenav');
}
var left = pos.left,
right = pos.left+($(this).width());
if(right-ulleft<=wth && left-ulleft>=0){
$(this).addclass('camera_visthumb');
}
});
}
$(window).bind('load resize pageshow',function(){
thumbnailpos();
thumbnailvisible();
});
cameracont.append('');
var started;
wrap.show();
var w = target.width();
var h = target.height();
var setpause;
$(window).bind('resize pageshow',function(){
if(started == true) {
resizeimage();
}
$('ul', thumbs).animate({'margin-top':0},0,thumbnailpos);
if(!elem.hasclass('paused')){
elem.addclass('paused');
if($('.camera_stop',camera_thumbs_wrap).length){
$('.camera_stop',camera_thumbs_wrap).hide()
$('.camera_play',camera_thumbs_wrap).show();
if(loader!='none'){
$('#'+pieid).hide();
}
} else {
if(loader!='none'){
$('#'+pieid).hide();
}
}
cleartimeout(setpause);
setpause = settimeout(function(){
elem.removeclass('paused');
if($('.camera_play',camera_thumbs_wrap).length){
$('.camera_play',camera_thumbs_wrap).hide();
$('.camera_stop',camera_thumbs_wrap).show();
if(loader!='none'){
$('#'+pieid).fadein();
}
} else {
if(loader!='none'){
$('#'+pieid).fadein();
}
}
},1500);
}
});
function resizeimage(){
var res;
function resizeimagework(){
w = wrap.width();
if(opts.height.indexof('%')!=-1) {
var starth = math.round(w / (100/parsefloat(opts.height)));
if(opts.minheight != '' && starth < parsefloat(opts.minheight)){
h = parsefloat(opts.minheight);
} else {
h = starth;
}
wrap.css({height:h});
} else if (opts.height=='auto') {
h = wrap.height();
} else {
h = parsefloat(opts.height);
wrap.css({height:h});
}
$('.camerarelative',target).css({'width':w,'height':h});
$('.imgloaded',target).each(function(){
var t = $(this),
wt = t.attr('width'),
ht = t.attr('height'),
imgloadin = t.index(),
mtop,
mleft,
alignment = t.attr('data-alignment'),
portrait = t.attr('data-portrait');
if(typeof alignment === 'undefined' || alignment === false || alignment === ''){
alignment = opts.alignment;
}
if(typeof portrait === 'undefined' || portrait === false || portrait === ''){
portrait = opts.portrait;
}
if(portrait==false||portrait=='false'){
if((wt/ht)<(w/h)) {
var r = w / wt;
var d = (math.abs(h - (ht*r)))*0.5;
switch(alignment){
case 'topleft':
mtop = 0;
break;
case 'topcenter':
mtop = 0;
break;
case 'topright':
mtop = 0;
break;
case 'centerleft':
mtop = '-'+d+'px';
break;
case 'center':
mtop = '-'+d+'px';
break;
case 'centerright':
mtop = '-'+d+'px';
break;
case 'bottomleft':
mtop = '-'+d*2+'px';
break;
case 'bottomcenter':
mtop = '-'+d*2+'px';
break;
case 'bottomright':
mtop = '-'+d*2+'px';
break;
}
t.css({
'height' : ht*r,
'margin-left' : 0,
'margin-right' : 0,
'margin-top' : mtop,
'position' : 'absolute',
'visibility' : 'visible',
'width' : w
});
}
else {
var r = h / ht;
var d = (math.abs(w - (wt*r)))*0.5;
switch(alignment){
case 'topleft':
mleft = 0;
break;
case 'topcenter':
mleft = '-'+d+'px';
break;
case 'topright':
mleft = '-'+d*2+'px';
break;
case 'centerleft':
mleft = 0;
break;
case 'center':
mleft = '-'+d+'px';
break;
case 'centerright':
mleft = '-'+d*2+'px';
break;
case 'bottomleft':
mleft = 0;
break;
case 'bottomcenter':
mleft = '-'+d+'px';
break;
case 'bottomright':
mleft = '-'+d*2+'px';
break;
}
t.css({
'height' : h,
'margin-left' : mleft,
'margin-right' : mleft,
'margin-top' : 0,
'position' : 'absolute',
'visibility' : 'visible',
'width' : wt*r
});
}
} else {
if((wt/ht)<(w/h)) {
var r = h / ht;
var d = (math.abs(w - (wt*r)))*0.5;
switch(alignment){
case 'topleft':
mleft = 0;
break;
case 'topcenter':
mleft = d+'px';
break;
case 'topright':
mleft = d*2+'px';
break;
case 'centerleft':
mleft = 0;
break;
case 'center':
mleft = d+'px';
break;
case 'centerright':
mleft = d*2+'px';
break;
case 'bottomleft':
mleft = 0;
break;
case 'bottomcenter':
mleft = d+'px';
break;
case 'bottomright':
mleft = d*2+'px';
break;
}
t.css({
'height' : h,
'margin-left' : mleft,
'margin-right' : mleft,
'margin-top' : 0,
'position' : 'absolute',
'visibility' : 'visible',
'width' : wt*r
});
}
else {
var r = w / wt;
var d = (math.abs(h - (ht*r)))*0.5;
switch(alignment){
case 'topleft':
mtop = 0;
break;
case 'topcenter':
mtop = 0;
break;
case 'topright':
mtop = 0;
break;
case 'centerleft':
mtop = d+'px';
break;
case 'center':
mtop = d+'px';
break;
case 'centerright':
mtop = d+'px';
break;
case 'bottomleft':
mtop = d*2+'px';
break;
case 'bottomcenter':
mtop = d*2+'px';
break;
case 'bottomright':
mtop = d*2+'px';
break;
}
t.css({
'height' : ht*r,
'margin-left' : 0,
'margin-right' : 0,
'margin-top' : mtop,
'position' : 'absolute',
'visibility' : 'visible',
'width' : w
});
}
}
});
}
if (started == true) {
cleartimeout(res);
res = settimeout(resizeimagework,200);
} else {
resizeimagework();
}
started = true;
}
var u,
sett;
var clickev,
autoadv,
navhover,
commands,
pagination;
var videohover,
videopresent;
if(ismobile() && opts.mobileautoadvance!=''){
autoadv = opts.mobileautoadvance;
} else {
autoadv = opts.autoadvance;
}
if(autoadv==false){
elem.addclass('paused');
}
if(ismobile() && opts.mobilenavhover!=''){
navhover = opts.mobilenavhover;
} else {
navhover = opts.navigationhover;
}
if(elem.length!=0){
var selector = $('.cameraslide',target);
selector.wrapinner('');
var navslide;
var bardirection = opts.bardirection;
var camera_thumbs_wrap = wrap;
$('iframe',fakehover).each(function(){
var t = $(this);
var src = t.attr('src');
t.attr('data-src',src);
var divind = t.parent().index('.camera_src > div');
$('.camera_target_content .cameracontent:eq('+divind+')',wrap).append(t);
});
function imgfake() {
$('iframe',fakehover).each(function(){
$('.camera_caption',fakehover).show();
var t = $(this);
var clonesrc = t.attr('data-src');
t.attr('src',clonesrc);
var imgfakeurl = opts.imagepath+'blank.gif';
var imgfake = new image();
imgfake.src = imgfakeurl;
if(opts.height.indexof('%')!=-1) {
var starth = math.round(w / (100/parsefloat(opts.height)));
if(opts.minheight != '' && starth < parsefloat(opts.minheight)){
h = parsefloat(opts.minheight);
} else {
h = starth;
}
} else if (opts.height=='auto') {
h = wrap.height();
} else {
h = parsefloat(opts.height);
}
t.after($(imgfake).attr({'class':'imgfake','width':w,'height':h}));
var clone = t.clone();
t.remove();
$(imgfake).bind('click',function(){
if($(this).css('position')=='absolute') {
$(this).remove();
if(clonesrc.indexof('vimeo') != -1 || clonesrc.indexof('youtube') != -1) {
if(clonesrc.indexof('?') != -1){
autoplay = '&autoplay=1';
} else {
autoplay = '?autoplay=1';
}
} else if(clonesrc.indexof('dailymotion') != -1) {
if(clonesrc.indexof('?') != -1){
autoplay = '&autoplay=1';
} else {
autoplay = '?autoplay=1';
}
}
clone.attr('src',clonesrc+autoplay);
videopresent = true;
} else {
$(this).css({position:'absolute',top:0,left:0,zindex:10}).after(clone);
clone.css({position:'absolute',top:0,left:0,zindex:9});
}
});
});
}
imgfake();
if(opts.hover==true){
if(!ismobile()){
fakehover.hover(function(){
elem.addclass('hovered');
},function(){
elem.removeclass('hovered');
});
}
}
if(navhover==true){
$(prevnav,wrap).animate({opacity:0},0);
$(nextnav,wrap).animate({opacity:0},0);
$(commands,wrap).animate({opacity:0},0);
if(ismobile()){
fakehover.live('vmouseover',function(){
$(prevnav,wrap).animate({opacity:1},200);
$(nextnav,wrap).animate({opacity:1},200);
$(commands,wrap).animate({opacity:1},200);
});
fakehover.live('vmouseout',function(){
$(prevnav,wrap).delay(500).animate({opacity:0},200);
$(nextnav,wrap).delay(500).animate({opacity:0},200);
$(commands,wrap).delay(500).animate({opacity:0},200);
});
} else {
fakehover.hover(function(){
$(prevnav,wrap).animate({opacity:1},200);
$(nextnav,wrap).animate({opacity:1},200);
$(commands,wrap).animate({opacity:1},200);
},function(){
$(prevnav,wrap).animate({opacity:0},200);
$(nextnav,wrap).animate({opacity:0},200);
$(commands,wrap).animate({opacity:0},200);
});
}
}
$('.camera_stop',camera_thumbs_wrap).live('click',function(){
autoadv = false;
elem.addclass('paused');
if($('.camera_stop',camera_thumbs_wrap).length){
$('.camera_stop',camera_thumbs_wrap).hide()
$('.camera_play',camera_thumbs_wrap).show();
if(loader!='none'){
$('#'+pieid).hide();
}
} else {
if(loader!='none'){
$('#'+pieid).hide();
}
}
});
$('.camera_play',camera_thumbs_wrap).live('click',function(){
autoadv = true;
elem.removeclass('paused');
if($('.camera_play',camera_thumbs_wrap).length){
$('.camera_play',camera_thumbs_wrap).hide();
$('.camera_stop',camera_thumbs_wrap).show();
if(loader!='none'){
$('#'+pieid).show();
}
} else {
if(loader!='none'){
$('#'+pieid).show();
}
}
});
if(opts.pauseonclick==true){
$('.camera_target_content',fakehover).mouseup(function(){
autoadv = false;
elem.addclass('paused');
$('.camera_stop',camera_thumbs_wrap).hide()
$('.camera_play',camera_thumbs_wrap).show();
$('#'+pieid).hide();
});
}
$('.cameracontent, .imgfake',fakehover).hover(function(){
videohover = true;
},function(){
videohover = false;
});
$('.cameracontent, .imgfake',fakehover).bind('click',function(){
if(videopresent == true && videohover == true) {
autoadv = false;
$('.camera_caption',fakehover).hide();
elem.addclass('paused');
$('.camera_stop',camera_thumbs_wrap).hide()
$('.camera_play',camera_thumbs_wrap).show();
$('#'+pieid).hide();
}
});
}
function shuffle(arr) {
for(
var j, x, i = arr.length; i;
j = parseint(math.random() * i),
x = arr[--i], arr[i] = arr[j], arr[j] = x
);
return arr;
}
function isinteger(s) {
return math.ceil(s) == math.floor(s);
}
if (loader != 'pie') {
barcontainer.append('');
$('.camera_bar_cont',barcontainer)
.animate({opacity:opts.loaderopacity},0)
.css({'position':'absolute', 'left':0, 'right':0, 'top':0, 'bottom':0, 'background-color':opts.loaderbgcolor})
.append('');
$('#'+pieid).animate({opacity:0},0);
var canvas = $('#'+pieid);
canvas.css({'position':'absolute', 'background-color':opts.loadercolor});
switch(opts.barposition){
case 'left':
barcontainer.css({right:'auto',width:opts.loaderstroke});
break;
case 'right':
barcontainer.css({left:'auto',width:opts.loaderstroke});
break;
case 'top':
barcontainer.css({bottom:'auto',height:opts.loaderstroke});
break;
case 'bottom':
barcontainer.css({top:'auto',height:opts.loaderstroke});
break;
}
switch(bardirection){
case 'lefttoright':
canvas.css({'left':0, 'right':0, 'top':opts.loaderpadding, 'bottom':opts.loaderpadding});
break;
case 'righttoleft':
canvas.css({'left':0, 'right':0, 'top':opts.loaderpadding, 'bottom':opts.loaderpadding});
break;
case 'toptobottom':
canvas.css({'left':opts.loaderpadding, 'right':opts.loaderpadding, 'top':0, 'bottom':0});
break;
case 'bottomtotop':
canvas.css({'left':opts.loaderpadding, 'right':opts.loaderpadding, 'top':0, 'bottom':0});
break;
}
} else {
piecontainer.append('');
var g_vmlcanvasmanager;
var canvas = document.getelementbyid(pieid);
canvas.setattribute("width", opts.piediameter);
canvas.setattribute("height", opts.piediameter);
var pieposition;
switch(opts.pieposition){
case 'lefttop' :
pieposition = 'left:0; top:0;';
break;
case 'righttop' :
pieposition = 'right:0; top:0;';
break;
case 'leftbottom' :
pieposition = 'left:0; bottom:0;';
break;
case 'rightbottom' :
pieposition = 'right:0; bottom:0;';
break;
}
canvas.setattribute("style", "position:absolute; z-index:1002; "+pieposition);
var rad;
var radnew;
if (canvas && canvas.getcontext) {
var ctx = canvas.getcontext("2d");
ctx.rotate(math.pi*(3/2));
ctx.translate(-opts.piediameter,0);
}
}
if(loader=='none' || autoadv==false) {
$('#'+pieid).hide();
$('.camera_canvas_wrap',camera_thumbs_wrap).hide();
}
if($(pagination).length) {
$(pagination).append('');
var li;
for (li = 0; li < amountslide; li++){
$('.camera_pag_ul',wrap).append(''+li+'');
}
$('.camera_pag_ul li',wrap).hover(function(){
$(this).addclass('camera_hover');
if($('.camera_thumb',this).length){
var wth = $('.camera_thumb',this).outerwidth(),
hth = $('.camera_thumb',this).outerheight(),
wtt = $(this).outerwidth();
$('.camera_thumb',this).show().css({'top':'-'+hth+'px','left':'-'+(wth-wtt)/2+'px'}).animate({'opacity':1,'margin-top':'-3px'},200);
$('.thumb_arrow',this).show().animate({'opacity':1,'margin-top':'-3px'},200);
}
},function(){
$(this).removeclass('camera_hover');
$('.camera_thumb',this).animate({'margin-top':'-20px','opacity':0},200,function(){
$(this).css({margintop:'5px'}).hide();
});
$('.thumb_arrow',this).animate({'margin-top':'-20px','opacity':0},200,function(){
$(this).css({margintop:'5px'}).hide();
});
});
}
if($(thumbs).length) {
var thumburl;
if(!$(pagination).length) {
$(thumbs).append('');
$(thumbs).before('').before('');
$('> div',thumbs).append('');
$.each(allthumbs, function(i, val) {
if($('> div', elem).eq(i).attr('data-thumb')!='') {
var thumburl = $('> div', elem).eq(i).attr('data-thumb'),
newimg = new image();
newimg.src = thumburl;
$('ul',thumbs).append('');
$('li.pix_thumb_'+i,thumbs).append($(newimg).attr('class','camera_thumb'));
}
});
} else {
$.each(allthumbs, function(i, val) {
if($('> div', elem).eq(i).attr('data-thumb')!='') {
var thumburl = $('> div', elem).eq(i).attr('data-thumb'),
newimg = new image();
newimg.src = thumburl;
$('li.pag_nav_'+i,pagination).append($(newimg).attr('class','camera_thumb').css({'position':'absolute'}).animate({opacity:0},0));
$('li.pag_nav_'+i+' > img',pagination).after('');
$('li.pag_nav_'+i+' > .thumb_arrow',pagination).animate({opacity:0},0);
}
});
wrap.css({marginbottom:$(pagination).outerheight()});
}
} else if(!$(thumbs).length && $(pagination).length) {
wrap.css({marginbottom:$(pagination).outerheight()});
}
var firstpos = true;
function thumbnailpos() {
if($(thumbs).length && !$(pagination).length) {
var wth = $(thumbs).outerwidth(),
owth = $('ul > li',thumbs).outerwidth(),
pos = $('li.cameracurrent', thumbs).length ? $('li.cameracurrent', thumbs).position() : '',
ulw = ($('ul > li', thumbs).length * $('ul > li', thumbs).outerwidth()),
offul = $('ul', thumbs).offset().left,
offdiv = $('> div', thumbs).offset().left,
ulleft;
if(offul<0){
ulleft = '-'+ (offdiv-offul);
} else {
ulleft = offdiv-offul;
}
if(firstpos == true) {
$('ul', thumbs).width($('ul > li', thumbs).length * $('ul > li', thumbs).outerwidth());
if($(thumbs).length && !$(pagination).lenght) {
wrap.css({marginbottom:$(thumbs).outerheight()});
}
thumbnailvisible();
/*i repeat this two lines because of a problem with iphones*/
$('ul', thumbs).width($('ul > li', thumbs).length * $('ul > li', thumbs).outerwidth());
if($(thumbs).length && !$(pagination).lenght) {
wrap.css({marginbottom:$(thumbs).outerheight()});
}
/*...*/
}
firstpos = false;
var left = $('li.cameracurrent', thumbs).length ? pos.left : '',
right = $('li.cameracurrent', thumbs).length ? pos.left+($('li.cameracurrent', thumbs).outerwidth()) : '';
if(left<$('li.cameracurrent', thumbs).outerwidth()) {
left = 0;
}
if(right-ulleft>wth){
if((left+wth)').append('');
if(autoadv==true){
$('.camera_play',camera_thumbs_wrap).hide();
$('.camera_stop',camera_thumbs_wrap).show();
} else {
$('.camera_stop',camera_thumbs_wrap).hide();
$('.camera_play',camera_thumbs_wrap).show();
}
}
function canvasloader() {
rad = 0;
var barwidth = $('.camera_bar_cont',camera_thumbs_wrap).width(),
barheight = $('.camera_bar_cont',camera_thumbs_wrap).height();
if (loader != 'pie') {
switch(bardirection){
case 'lefttoright':
$('#'+pieid).css({'right':barwidth});
break;
case 'righttoleft':
$('#'+pieid).css({'left':barwidth});
break;
case 'toptobottom':
$('#'+pieid).css({'bottom':barheight});
break;
case 'bottomtotop':
$('#'+pieid).css({'top':barheight});
break;
}
} else {
ctx.clearrect(0,0,opts.piediameter,opts.piediameter);
}
}
canvasloader();
$('.movefromleft, .movefromright, .movefromtop, .movefrombottom, .fadein, .fadefromleft, .fadefromright, .fadefromtop, .fadefrombottom',fakehover).each(function(){
$(this).css('visibility','hidden');
});
opts.onstartloading.call(this);
nextslide();
/*************************** function nextslide() ***************************/
function nextslide(navslide){
elem.addclass('camerasliding');
videopresent = false;
var vis = parsefloat($('div.cameraslide.cameracurrent',target).index());
if(navslide>0){
var slidei = navslide-1;
} else if (vis == amountslide-1) {
var slidei = 0;
} else {
var slidei = vis+1;
}
var slide = $('.cameraslide:eq('+slidei+')',target);
var slidenext = $('.cameraslide:eq('+(slidei+1)+')',target).addclass('cameranext');
if( vis != slidei+1 ) {
slidenext.hide();
}
$('.cameracontent',fakehover).fadeout(600);
$('.camera_caption',fakehover).show();
$('.camerarelative',slide).append($('> div ',elem).eq(slidei).find('> div.camera_effected'));
$('.camera_target_content .cameracontent:eq('+slidei+')',wrap).append($('> div ',elem).eq(slidei).find('> div'));
if(!$('.imgloaded',slide).length){
var imgurl = allimg[slidei];
var imgloaded = new image();
imgloaded.src = imgurl +"?"+ new date().gettime();
slide.css('visibility','hidden');
slide.prepend($(imgloaded).attr('class','imgloaded').css('visibility','hidden'));
var wt, ht;
if (!$(imgloaded).get(0).complete || wt == '0' || ht == '0' || typeof wt === 'undefined' || wt === false || typeof ht === 'undefined' || ht === false) {
$('.camera_loader',wrap).delay(500).fadein(400);
imgloaded.onload = function() {
wt = imgloaded.naturalwidth;
ht = imgloaded.naturalheight;
$(imgloaded).attr('data-alignment',allalign[slidei]).attr('data-portrait',allpor[slidei]);
$(imgloaded).attr('width',wt);
$(imgloaded).attr('height',ht);
target.find('.cameraslide_'+slidei).hide().css('visibility','visible');
resizeimage();
nextslide(slidei+1);
};
}
} else {
if( allimg.length > (slidei+1) && !$('.imgloaded',slidenext).length ){
var imgurl2 = allimg[(slidei+1)];
var imgloaded2 = new image();
imgloaded2.src = imgurl2 +"?"+ new date().gettime();
slidenext.prepend($(imgloaded2).attr('class','imgloaded').css('visibility','hidden'));
imgloaded2.onload = function() {
wt = imgloaded2.naturalwidth;
ht = imgloaded2.naturalheight;
$(imgloaded2).attr('data-alignment',allalign[slidei+1]).attr('data-portrait',allpor[slidei+1]);
$(imgloaded2).attr('width',wt);
$(imgloaded2).attr('height',ht);
resizeimage();
};
}
opts.onloaded.call(this);
if($('.camera_loader',wrap).is(':visible')){
$('.camera_loader',wrap).fadeout(400);
} else {
$('.camera_loader',wrap).css({'visibility':'hidden'});
$('.camera_loader',wrap).fadeout(400,function(){
$('.camera_loader',wrap).css({'visibility':'visible'});
});
}
var rows = opts.rows,
cols = opts.cols,
couples = 1,
difference = 0,
dataslideon,
time,
transperiod,
fx,
easing,
randomfx = new array('simplefade','curtaintopleft','curtaintopright','curtainbottomleft','curtainbottomright','curtainsliceleft','curtainsliceright','blindcurtaintopleft','blindcurtaintopright','blindcurtainbottomleft','blindcurtainbottomright','blindcurtainslicebottom','blindcurtainslicetop','stampede','mosaic','mosaicreverse','mosaicrandom','mosaicspiral','mosaicspiralreverse','topleftbottomright','bottomrighttopleft','bottomlefttopright','toprightbottomleft','scrollleft','scrollright','scrolltop','scrollbottom','scrollhorz');
marginleft = 0,
margintop = 0,
opacityongrid = 0;
if(opts.opacityongrid==true){
opacityongrid = 0;
} else {
opacityongrid = 1;
}
var datafx = $(' > div',elem).eq(slidei).attr('data-fx');
if(ismobile()&&opts.mobilefx!=''&&opts.mobilefx!='default'){
fx = opts.mobilefx;
} else {
if(typeof datafx !== 'undefined' && datafx!== false && datafx!== 'default'){
fx = datafx;
} else {
fx = opts.fx;
}
}
if(fx=='random') {
fx = shuffle(randomfx);
fx = fx[0];
} else {
fx = fx;
if(fx.indexof(',')>0){
fx = fx.replace(/ /g,'');
fx = fx.split(',');
fx = shuffle(fx);
fx = fx[0];
}
}
dataeasing = $(' > div',elem).eq(slidei).attr('data-easing');
mobileeasing = $(' > div',elem).eq(slidei).attr('data-mobileeasing');
if(ismobile()&&opts.mobileeasing!=''&&opts.mobileeasing!='default'){
if(typeof mobileeasing !== 'undefined' && mobileeasing!== false && mobileeasing!== 'default') {
easing = mobileeasing;
} else {
easing = opts.mobileeasing;
}
} else {
if(typeof dataeasing !== 'undefined' && dataeasing!== false && dataeasing!== 'default') {
easing = dataeasing;
} else {
easing = opts.easing;
}
}
dataslideon = $(' > div',elem).eq(slidei).attr('data-slideon');
if(typeof dataslideon !== 'undefined' && dataslideon!== false){
slideon = dataslideon;
} else {
if(opts.slideon=='random'){
var slideon = new array('next','prev');
slideon = shuffle(slideon);
slideon = slideon[0];
} else {
slideon = opts.slideon;
}
}
var datatime = $(' > div',elem).eq(slidei).attr('data-time');
if(typeof datatime !== 'undefined' && datatime!== false && datatime!== ''){
time = parsefloat(datatime);
} else {
time = opts.time;
}
var datatransperiod = $(' > div',elem).eq(slidei).attr('data-transperiod');
if(typeof datatransperiod !== 'undefined' && datatransperiod!== false && datatransperiod!== ''){
transperiod = parsefloat(datatransperiod);
} else {
transperiod = opts.transperiod;
}
if(!$(elem).hasclass('camerastarted')){
fx = 'simplefade';
slideon = 'next';
easing = '';
transperiod = 400;
$(elem).addclass('camerastarted')
}
switch(fx){
case 'simplefade':
cols = 1;
rows = 1;
break;
case 'curtaintopleft':
if(opts.slicedcols == 0) {
cols = opts.cols;
} else {
cols = opts.slicedcols;
}
rows = 1;
break;
case 'curtaintopright':
if(opts.slicedcols == 0) {
cols = opts.cols;
} else {
cols = opts.slicedcols;
}
rows = 1;
break;
case 'curtainbottomleft':
if(opts.slicedcols == 0) {
cols = opts.cols;
} else {
cols = opts.slicedcols;
}
rows = 1;
break;
case 'curtainbottomright':
if(opts.slicedcols == 0) {
cols = opts.cols;
} else {
cols = opts.slicedcols;
}
rows = 1;
break;
case 'curtainsliceleft':
if(opts.slicedcols == 0) {
cols = opts.cols;
} else {
cols = opts.slicedcols;
}
rows = 1;
break;
case 'curtainsliceright':
if(opts.slicedcols == 0) {
cols = opts.cols;
} else {
cols = opts.slicedcols;
}
rows = 1;
break;
case 'blindcurtaintopleft':
if(opts.slicedrows == 0) {
rows = opts.rows;
} else {
rows = opts.slicedrows;
}
cols = 1;
break;
case 'blindcurtaintopright':
if(opts.slicedrows == 0) {
rows = opts.rows;
} else {
rows = opts.slicedrows;
}
cols = 1;
break;
case 'blindcurtainbottomleft':
if(opts.slicedrows == 0) {
rows = opts.rows;
} else {
rows = opts.slicedrows;
}
cols = 1;
break;
case 'blindcurtainbottomright':
if(opts.slicedrows == 0) {
rows = opts.rows;
} else {
rows = opts.slicedrows;
}
cols = 1;
break;
case 'blindcurtainslicetop':
if(opts.slicedrows == 0) {
rows = opts.rows;
} else {
rows = opts.slicedrows;
}
cols = 1;
break;
case 'blindcurtainslicebottom':
if(opts.slicedrows == 0) {
rows = opts.rows;
} else {
rows = opts.slicedrows;
}
cols = 1;
break;
case 'stampede':
difference = '-'+transperiod;
break;
case 'mosaic':
difference = opts.griddifference;
break;
case 'mosaicreverse':
difference = opts.griddifference;
break;
case 'mosaicrandom':
break;
case 'mosaicspiral':
difference = opts.griddifference;
couples = 1.7;
break;
case 'mosaicspiralreverse':
difference = opts.griddifference;
couples = 1.7;
break;
case 'topleftbottomright':
difference = opts.griddifference;
couples = 6;
break;
case 'bottomrighttopleft':
difference = opts.griddifference;
couples = 6;
break;
case 'bottomlefttopright':
difference = opts.griddifference;
couples = 6;
break;
case 'toprightbottomleft':
difference = opts.griddifference;
couples = 6;
break;
case 'scrollleft':
cols = 1;
rows = 1;
break;
case 'scrollright':
cols = 1;
rows = 1;
break;
case 'scrolltop':
cols = 1;
rows = 1;
break;
case 'scrollbottom':
cols = 1;
rows = 1;
break;
case 'scrollhorz':
cols = 1;
rows = 1;
break;
}
var cycle = 0;
var blocks = rows*cols;
var leftscrap = w-(math.floor(w/cols)*cols);
var topscrap = h-(math.floor(h/rows)*rows);
var addleft;
var addtop;
var tappw = 0;
var tapph = 0;
var arr = new array();
var delay = new array();
var order = new array();
while(cycle < blocks){
arr.push(cycle);
delay.push(cycle);
cameracont.append('');
var tapp = $('.cameraappended:eq('+cycle+')',target);
if(fx=='scrollleft' || fx=='scrollright' || fx=='scrolltop' || fx=='scrollbottom' || fx=='scrollhorz'){
selector.eq(slidei).clone().show().appendto(tapp);
} else {
if(slideon=='next'){
selector.eq(slidei).clone().show().appendto(tapp);
} else {
selector.eq(vis).clone().show().appendto(tapp);
}
}
if(cycle%cols .cameraslide', tapp).css({
'height': h,
'margin-left': '-'+tappw+'px',
'margin-top': '-'+tapph+'px',
'width': w
});
tappw = tappw+tapp.width()-1;
if(cycle%cols==cols-1){
tapph = tapph + tapp.height() - 1;
}
cycle++;
}
switch(fx){
case 'curtaintopleft':
break;
case 'curtainbottomleft':
break;
case 'curtainsliceleft':
break;
case 'curtaintopright':
arr = arr.reverse();
break;
case 'curtainbottomright':
arr = arr.reverse();
break;
case 'curtainsliceright':
arr = arr.reverse();
break;
case 'blindcurtaintopleft':
break;
case 'blindcurtainbottomleft':
arr = arr.reverse();
break;
case 'blindcurtainslicetop':
break;
case 'blindcurtaintopright':
break;
case 'blindcurtainbottomright':
arr = arr.reverse();
break;
case 'blindcurtainslicebottom':
arr = arr.reverse();
break;
case 'stampede':
arr = shuffle(arr);
break;
case 'mosaic':
break;
case 'mosaicreverse':
arr = arr.reverse();
break;
case 'mosaicrandom':
arr = shuffle(arr);
break;
case 'mosaicspiral':
var rows2 = rows/2, x, y, z, n=0;
for (z = 0; z < rows2; z++){
y = z;
for (x = z; x < cols - z - 1; x++) {
order[n++] = y * cols + x;
}
x = cols - z - 1;
for (y = z; y < rows - z - 1; y++) {
order[n++] = y * cols + x;
}
y = rows - z - 1;
for (x = cols - z - 1; x > z; x--) {
order[n++] = y * cols + x;
}
x = z;
for (y = rows - z - 1; y > z; y--) {
order[n++] = y * cols + x;
}
}
arr = order;
break;
case 'mosaicspiralreverse':
var rows2 = rows/2, x, y, z, n=blocks-1;
for (z = 0; z < rows2; z++){
y = z;
for (x = z; x < cols - z - 1; x++) {
order[n--] = y * cols + x;
}
x = cols - z - 1;
for (y = z; y < rows - z - 1; y++) {
order[n--] = y * cols + x;
}
y = rows - z - 1;
for (x = cols - z - 1; x > z; x--) {
order[n--] = y * cols + x;
}
x = z;
for (y = rows - z - 1; y > z; y--) {
order[n--] = y * cols + x;
}
}
arr = order;
break;
case 'topleftbottomright':
for (var y = 0; y < rows; y++)
for (var x = 0; x < cols; x++) {
order.push(x + y);
}
delay = order;
break;
case 'bottomrighttopleft':
for (var y = 0; y < rows; y++)
for (var x = 0; x < cols; x++) {
order.push(x + y);
}
delay = order.reverse();
break;
case 'bottomlefttopright':
for (var y = rows; y > 0; y--)
for (var x = 0; x < cols; x++) {
order.push(x + y);
}
delay = order;
break;
case 'toprightbottomleft':
for (var y = 0; y < rows; y++)
for (var x = cols; x > 0; x--) {
order.push(x + y);
}
delay = order;
break;
}
$.each(arr, function(index, value) {
if(value%cols=0){
$(thumbs).css({visibility:'visible'});
}
if($('.cameraeased',target).length==blocks){
thumbnailpos();
$('.movefromleft, .movefromright, .movefromtop, .movefrombottom, .fadein, .fadefromleft, .fadefromright, .fadefromtop, .fadefrombottom',fakehover).each(function(){
$(this).css('visibility','hidden');
});
selector.eq(slidei).show().css('z-index','999').removeclass('cameranext').addclass('cameracurrent');
selector.eq(vis).css('z-index','1').removeclass('cameracurrent');
$('.cameracontent',fakehover).eq(slidei).addclass('cameracurrent');
if (vis >= 0) {
$('.cameracontent',fakehover).eq(vis).removeclass('cameracurrent');
}
opts.onendtransition.call(this);
if($('> div', elem).eq(slidei).attr('data-video')!='hide' && $('.cameracontent.cameracurrent .imgfake',fakehover).length ){
$('.cameracontent.cameracurrent .imgfake',fakehover).click();
}
var lmovein = selector.eq(slidei).find('.fadein').length;
var lmoveincontent = $('.cameracontent',fakehover).eq(slidei).find('.movefromleft, .movefromright, .movefromtop, .movefrombottom, .fadein, .fadefromleft, .fadefromright, .fadefromtop, .fadefrombottom').length;
if (lmovein!=0){
$('.cameraslide.cameracurrent .fadein',fakehover).each(function(){
if($(this).attr('data-easing')!=''){
var easemove = $(this).attr('data-easing');
} else {
var easemove = easing;
}
var t = $(this);
if(typeof t.attr('data-outerwidth') === 'undefined' || t.attr('data-outerwidth') === false || t.attr('data-outerwidth') === '') {
var wmovein = t.outerwidth();
t.attr('data-outerwidth',wmovein);
} else {
var wmovein = t.attr('data-outerwidth');
}
if(typeof t.attr('data-outerheight') === 'undefined' || t.attr('data-outerheight') === false || t.attr('data-outerheight') === '') {
var hmovein = t.outerheight();
t.attr('data-outerheight',hmovein);
} else {
var hmovein = t.attr('data-outerheight');
}
//t.css('width',wmovein);
var pos = t.position();
var left = pos.left;
var top = pos.top;
var tclass = t.attr('class');
var ind = t.index();
var hrel = t.parents('.camerarelative').outerheight();
var wrel = t.parents('.camerarelative').outerwidth();
if(tclass.indexof("fadein") != -1) {
t.animate({opacity:0},0).css('visibility','visible').delay((time/lmovein)*(0.1*(ind-1))).animate({opacity:1},(time/lmovein)*0.15,easemove);
} else {
t.css('visibility','visible');
}
});
}
$('.cameracontent.cameracurrent',fakehover).show();
if (lmoveincontent!=0){
$('.cameracontent.cameracurrent .movefromleft, .cameracontent.cameracurrent .movefromright, .cameracontent.cameracurrent .movefromtop, .cameracontent.cameracurrent .movefrombottom, .cameracontent.cameracurrent .fadein, .cameracontent.cameracurrent .fadefromleft, .cameracontent.cameracurrent .fadefromright, .cameracontent.cameracurrent .fadefromtop, .cameracontent.cameracurrent .fadefrombottom',fakehover).each(function(){
if($(this).attr('data-easing')!=''){
var easemove = $(this).attr('data-easing');
} else {
var easemove = easing;
}
var t = $(this);
var pos = t.position();
var left = pos.left;
var top = pos.top;
var tclass = t.attr('class');
var ind = t.index();
var thish = t.outerheight();
if(tclass.indexof("movefromleft") != -1) {
t.css({'left':'-'+(w)+'px','right':'auto'});
t.css('visibility','visible').delay((time/lmoveincontent)*(0.1*(ind-1))).animate({'left':pos.left},(time/lmoveincontent)*0.15,easemove);
} else if(tclass.indexof("movefromright") != -1) {
t.css({'left':w+'px','right':'auto'});
t.css('visibility','visible').delay((time/lmoveincontent)*(0.1*(ind-1))).animate({'left':pos.left},(time/lmoveincontent)*0.15,easemove);
} else if(tclass.indexof("movefromtop") != -1) {
t.css({'top':'-'+h+'px','bottom':'auto'});
t.css('visibility','visible').delay((time/lmoveincontent)*(0.1*(ind-1))).animate({'top':pos.top},(time/lmoveincontent)*0.15,easemove,function(){
t.css({top:'auto',bottom:0});
});
} else if(tclass.indexof("movefrombottom") != -1) {
t.css({'top':h+'px','bottom':'auto'});
t.css('visibility','visible').delay((time/lmoveincontent)*(0.1*(ind-1))).animate({'top':pos.top},(time/lmoveincontent)*0.15,easemove);
} else if(tclass.indexof("fadefromleft") != -1) {
t.animate({opacity:0},0).css({'left':'-'+(w)+'px','right':'auto'});
t.css('visibility','visible').delay((time/lmoveincontent)*(0.1*(ind-1))).animate({'left':pos.left,opacity:1},(time/lmoveincontent)*0.15,easemove);
} else if(tclass.indexof("fadefromright") != -1) {
t.animate({opacity:0},0).css({'left':(w)+'px','right':'auto'});
t.css('visibility','visible').delay((time/lmoveincontent)*(0.1*(ind-1))).animate({'left':pos.left,opacity:1},(time/lmoveincontent)*0.15,easemove);
} else if(tclass.indexof("fadefromtop") != -1) {
t.animate({opacity:0},0).css({'top':'-'+(h)+'px','bottom':'auto'});
t.css('visibility','visible').delay((time/lmoveincontent)*(0.1*(ind-1))).animate({'top':pos.top,opacity:1},(time/lmoveincontent)*0.15,easemove,function(){
t.css({top:'auto',bottom:0});
});
} else if(tclass.indexof("fadefrombottom") != -1) {
t.animate({opacity:0},0).css({'bottom':'-'+thish+'px'});
t.css('visibility','visible').delay((time/lmoveincontent)*(0.1*(ind-1))).animate({'bottom':'0',opacity:1},(time/lmoveincontent)*0.15,easemove);
} else if(tclass.indexof("fadein") != -1) {
t.animate({opacity:0},0).css('visibility','visible').delay((time/lmoveincontent)*(0.1*(ind-1))).animate({opacity:1},(time/lmoveincontent)*0.15,easemove);
} else {
t.css('visibility','visible');
}
});
}
$('.cameraappended',target).remove();
elem.removeclass('camerasliding');
selector.eq(vis).hide();
var barwidth = $('.camera_bar_cont',camera_thumbs_wrap).width(),
barheight = $('.camera_bar_cont',camera_thumbs_wrap).height(),
radsum;
if (loader != 'pie') {
radsum = 0.05;
} else {
radsum = 0.005;
}
$('#'+pieid).animate({opacity:opts.loaderopacity},200);
u = setinterval(
function(){
if(elem.hasclass('stopped')){
clearinterval(u);
}
if (loader != 'pie') {
if(rad<=1.002 && !elem.hasclass('stopped') && !elem.hasclass('paused') && !elem.hasclass('hovered')){
rad = (rad+radsum);
} else if (rad<=1 && (elem.hasclass('stopped') || elem.hasclass('paused') || elem.hasclass('stopped') || elem.hasclass('hovered'))){
rad = rad;
} else {
if(!elem.hasclass('stopped') && !elem.hasclass('paused') && !elem.hasclass('hovered')) {
clearinterval(u);
imgfake();
$('#'+pieid).animate({opacity:0},200,function(){
cleartimeout(sett);
sett = settimeout(canvasloader,easedtime);
nextslide();
opts.onstartloading.call(this);
});
}
}
switch(bardirection){
case 'lefttoright':
$('#'+pieid).animate({'right':barwidth-(barwidth*rad)},(time*radsum),'linear');
break;
case 'righttoleft':
$('#'+pieid).animate({'left':barwidth-(barwidth*rad)},(time*radsum),'linear');
break;
case 'toptobottom':
$('#'+pieid).animate({'bottom':barheight-(barheight*rad)},(time*radsum),'linear');
break;
case 'bottomtotop':
$('#'+pieid).animate({'bottom':barheight-(barheight*rad)},(time*radsum),'linear');
break;
}
} else {
radnew = rad;
ctx.clearrect(0,0,opts.piediameter,opts.piediameter);
ctx.globalcompositeoperation = 'destination-over';
ctx.beginpath();
ctx.arc((opts.piediameter)/2, (opts.piediameter)/2, (opts.piediameter)/2-opts.loaderstroke,0,math.pi*2,false);
ctx.linewidth = opts.loaderstroke;
ctx.strokestyle = opts.loaderbgcolor;
ctx.stroke();
ctx.closepath();
ctx.globalcompositeoperation = 'source-over';
ctx.beginpath();
ctx.arc((opts.piediameter)/2, (opts.piediameter)/2, (opts.piediameter)/2-opts.loaderstroke,0,math.pi*2*radnew,false);
ctx.linewidth = opts.loaderstroke-(opts.loaderpadding*2);
ctx.strokestyle = opts.loadercolor;
ctx.stroke();
ctx.closepath();
if(rad<=1.002 && !elem.hasclass('stopped') && !elem.hasclass('paused') && !elem.hasclass('hovered')){
rad = (rad+radsum);
} else if (rad<=1 && (elem.hasclass('stopped') || elem.hasclass('paused') || elem.hasclass('hovered'))){
rad = rad;
} else {
if(!elem.hasclass('stopped') && !elem.hasclass('paused') && !elem.hasclass('hovered')) {
clearinterval(u);
imgfake();
$('#'+pieid+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0},200,function(){
cleartimeout(sett);
sett = settimeout(canvasloader,easedtime);
nextslide();
opts.onstartloading.call(this);
});
}
}
}
},time*radsum
);
}
}
if(fx=='scrollleft' || fx=='scrollright' || fx=='scrolltop' || fx=='scrollbottom' || fx=='scrollhorz'){
opts.onstarttransition.call(this);
easedtime = 0;
tapp.delay((((transperiod+difference)/blocks)*delay[index]*couples)*0.5).css({
'display' : 'block',
'height': height,
'margin-left': marginleft,
'margin-top': margintop,
'width': width
}).animate({
'height': math.floor((h/rows)+addtop+1),
'margin-top' : 0,
'margin-left' : 0,
'width' : math.floor((w/cols)+addleft+1)
},(transperiod-difference),easing,cameraeased);
selector.eq(vis).delay((((transperiod+difference)/blocks)*delay[index]*couples)*0.5).animate({
'margin-left': marginleft*(-1),
'margin-top': margintop*(-1)
},(transperiod-difference),easing,function(){
$(this).css({'margin-top' : 0,'margin-left' : 0});
});
} else {
opts.onstarttransition.call(this);
easedtime = parsefloat(transperiod)+parsefloat(difference);
if(slideon=='next'){
tapp.delay((((transperiod+difference)/blocks)*delay[index]*couples)*0.5).css({
'display' : 'block',
'height': height,
'margin-left': marginleft,
'margin-top': margintop,
'width': width,
'opacity' : opacityongrid
}).animate({
'height': math.floor((h/rows)+addtop+1),
'margin-top' : 0,
'margin-left' : 0,
'opacity' : 1,
'width' : math.floor((w/cols)+addleft+1)
},(transperiod-difference),easing,cameraeased);
} else {
selector.eq(slidei).show().css('z-index','999').addclass('cameracurrent');
selector.eq(vis).css('z-index','1').removeclass('cameracurrent');
$('.cameracontent',fakehover).eq(slidei).addclass('cameracurrent');
$('.cameracontent',fakehover).eq(vis).removeclass('cameracurrent');
tapp.delay((((transperiod+difference)/blocks)*delay[index]*couples)*0.5).css({
'display' : 'block',
'height': math.floor((h/rows)+addtop+1),
'margin-top' : 0,
'margin-left' : 0,
'opacity' : 1,
'width' : math.floor((w/cols)+addleft+1)
}).animate({
'height': height,
'margin-left': marginleft,
'margin-top': margintop,
'width': width,
'opacity' : opacityongrid
},(transperiod-difference),easing,cameraeased);
}
}
});
}
}
if($(prevnav).length){
$(prevnav).click(function(){
if(!elem.hasclass('camerasliding')){
var idnum = parsefloat($('.cameraslide.cameracurrent',target).index());
clearinterval(u);
imgfake();
$('#'+pieid+', .camera_canvas_wrap',wrap).animate({opacity:0},0);
canvasloader();
if(idnum!=0){
nextslide(idnum);
} else {
nextslide(amountslide);
}
opts.onstartloading.call(this);
}
});
}
if($(nextnav).length){
$(nextnav).click(function(){
if(!elem.hasclass('camerasliding')){
var idnum = parsefloat($('.cameraslide.cameracurrent',target).index());
clearinterval(u);
imgfake();
$('#'+pieid+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0},0);
canvasloader();
if(idnum==amountslide-1){
nextslide(1);
} else {
nextslide(idnum+2);
}
opts.onstartloading.call(this);
}
});
}
if(ismobile()){
fakehover.bind('swipeleft',function(event){
if(!elem.hasclass('camerasliding')){
var idnum = parsefloat($('.cameraslide.cameracurrent',target).index());
clearinterval(u);
imgfake();
$('#'+pieid+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0},0);
canvasloader();
if(idnum==amountslide-1){
nextslide(1);
} else {
nextslide(idnum+2);
}
opts.onstartloading.call(this);
}
});
fakehover.bind('swiperight',function(event){
if(!elem.hasclass('camerasliding')){
var idnum = parsefloat($('.cameraslide.cameracurrent',target).index());
clearinterval(u);
imgfake();
$('#'+pieid+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0},0);
canvasloader();
if(idnum!=0){
nextslide(idnum);
} else {
nextslide(amountslide);
}
opts.onstartloading.call(this);
}
});
}
if($(pagination).length){
$('.camera_pag li',wrap).click(function(){
if(!elem.hasclass('camerasliding')){
var idnum = parsefloat($(this).index());
var curnum = parsefloat($('.cameraslide.cameracurrent',target).index());
if(idnum!=curnum) {
clearinterval(u);
imgfake();
$('#'+pieid+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0},0);
canvasloader();
nextslide(idnum+1);
opts.onstartloading.call(this);
}
}
});
}
if($(thumbs).length) {
$('.pix_thumb img',thumbs).click(function(){
if(!elem.hasclass('camerasliding')){
var idnum = parsefloat($(this).parents('li').index());
var curnum = parsefloat($('.cameracurrent',target).index());
if(idnum!=curnum) {
clearinterval(u);
imgfake();
$('#'+pieid+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0},0);
$('.pix_thumb',thumbs).removeclass('cameracurrent');
$(this).parents('li').addclass('cameracurrent');
canvasloader();
nextslide(idnum+1);
thumbnailpos();
opts.onstartloading.call(this);
}
}
});
$('.camera_thumbs_cont .camera_prevthumbs',camera_thumbs_wrap).hover(function(){
$(this).stop(true,false).animate({opacity:1},250);
},function(){
$(this).stop(true,false).animate({opacity:.7},250);
});
$('.camera_prevthumbs',camera_thumbs_wrap).click(function(){
var sum = 0,
wth = $(thumbs).outerwidth(),
offul = $('ul', thumbs).offset().left,
offdiv = $('> div', thumbs).offset().left,
ulleft = offdiv-offul;
$('.camera_visthumb',thumbs).each(function(){
var tw = $(this).outerwidth();
sum = sum+tw;
});
if(ulleft-sum>0){
$('ul', thumbs).animate({'margin-left':'-'+(ulleft-sum)+'px'},500,thumbnailvisible);
} else {
$('ul', thumbs).animate({'margin-left':0},500,thumbnailvisible);
}
});
$('.camera_thumbs_cont .camera_nextthumbs',camera_thumbs_wrap).hover(function(){
$(this).stop(true,false).animate({opacity:1},250);
},function(){
$(this).stop(true,false).animate({opacity:.7},250);
});
$('.camera_nextthumbs',camera_thumbs_wrap).click(function(){
var sum = 0,
wth = $(thumbs).outerwidth(),
ulw = $('ul', thumbs).outerwidth(),
offul = $('ul', thumbs).offset().left,
offdiv = $('> div', thumbs).offset().left,
ulleft = offdiv-offul;
$('.camera_visthumb',thumbs).each(function(){
var tw = $(this).outerwidth();
sum = sum+tw;
});
if(ulleft+sum+sum