// 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('