Skip to content

Instantly share code, notes, and snippets.

@daltonrooney
Created August 6, 2011 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daltonrooney/1129276 to your computer and use it in GitHub Desktop.
Save daltonrooney/1129276 to your computer and use it in GitHub Desktop.
Portfolio Slideshow custom
(function(a){a.fn.touchwipe=function(c){var b={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};if(c){a.extend(b,c)}this.each(function(){var e;var d;var i=false;function h(){this.removeEventListener("touchmove",f);e=null;i=false}function f(m){if(b.preventDefaultEvents){m.preventDefault()}if(i){var j=m.touches[0].pageX;var n=m.touches[0].pageY;var l=e-j;var k=d-n;if(Math.abs(l)>=b.min_move_x){h();if(l>0){b.wipeLeft()
}else{b.wipeRight()}}else{if(Math.abs(k)>=b.min_move_y){h();if(k>0){b.wipeDown()}else{b.wipeUp()}}}}}function g(j){if(j.touches.length==1){e=j.touches[0].pageX;d=j.touches[0].pageY;i=true;this.addEventListener("touchmove",f,false)}}if("ontouchstart" in document.documentElement){this.addEventListener("touchstart",g,false)}});return this}})(jQuery);jQuery(document).ready(function(a){a(window).load(function(){var g,e,c,b,f;currSlide=new Array();tabSlide=new Array();g=portfolioSlideshowOptions.psLoader;
e=portfolioSlideshowOptions.psHash;c=portfolioSlideshowOptions.psFancyBox;b=portfolioSlideshowOptions.psInfoTxt;if(jQuery.browser.msie&&parseInt(jQuery.browser.version)<8){ie=true}else{ie=false}if(c===true){function d(k,j,h,i){return'<div id="image-caption">'+(k&&k.length?"<b>"+k+"</b>":"")+" Image "+(h+1)+" of "+j.length+"</div>"}a("a.fancybox, .gallery-item 'a[href$='.gif'], .gallery-item 'a[href$='.jpg'], .gallery-item 'a[href$='.png'], .gallery-item 'a[href$='.jpeg']").fancybox({titlePosition:"inside",titleFormat:d})
}if(g===true){a(".slideshow-wrapper").delay(1000).queue(function(){a(".portfolio-slideshow, .slideshow-nav, .pager").css("visibility","visible");a(this).removeClass("showloader")})}a("div[id^=portfolio-slideshow]").each(function(){var h=this.id.match(/portfolio-slideshow(\d+)/)[1];if(ie===true){a("#slideshow-wrapper"+h).addClass("ie")}a("#scrollable"+h).scrollable({keyboard:false}).navigator({navi:"#carouselnav"+h,naviItem:"a"});a("#slideshow-wrapper"+h+" a.show").click(function(){a(this).hide();
a("#slideshow-wrapper"+h+" a.hide").addClass("active");a("#slideshow-wrapper"+h+" .pscarousel").fadeIn("fast")});a("#slideshow-wrapper"+h+" a.hide").click(function(){a(this).removeClass("active");a("#slideshow-wrapper"+h+" a.show").show();a("#slideshow-wrapper"+h+" .pscarousel").fadeOut("fast")});a(function(){var l=0,n=window.location.hash;if(/\d+/.exec(n)){l=/\d+/.exec(n)[0];l=(parseInt(l)||1)-1}if(psPagerStyle[h]==="thumbs"){a.fn.cycle.updateActivePagerLink=function(q,r){a(q).find("img").removeClass("activeSlide").filter("#pager"+h+" img:eq("+r+")").addClass("activeSlide")
}}else{a.fn.cycle.updateActivePagerLink=function(q,r){a(q).find("a").removeClass("activeSlide").filter("#pager"+h+" a:eq("+r+")").addClass("activeSlide")}}function o(){a("#portfolio-slideshow"+h).cycle({fx:psTrans[h],speed:psSpeed[h],timeout:psTimeout[h],random:psRandom[h],nowrap:psNoWrap[h],next:"#slideshow-wrapper"+h+" a.slideshow-next, #slideshow-wrapper"+h+" #psnext"+h,startingSlide:l,prev:"#slideshow-wrapper"+h+" a.slideshow-prev , #slideshow-wrapper"+h+" #psprev"+h,before:p,after:i,end:k,slideExpr:".slideshow-content",manualTrump:true,slideResize:false,containerResize:false,pager:"#pager"+h,cleartypeNoBg:true,pagerAnchorBuilder:j})
}function m(){a("#portfolio-slideshow"+h).cycle({fx:psTrans[h],speed:psSpeed[h],timeout:psTimeout[h],random:psRandom[h],nowrap:psNoWrap[h],next:"#slideshow-wrapper"+h+" a.slideshow-next, #psnext"+h,startingSlide:l,prev:"#slideshow-wrapper"+h+" a.slideshow-prev, #psprev"+h,before:p,after:i,slideExpr:".slideshow-content",end:k,manualTrump:true,slideResize:false,containerResize:false,pager:"#pager"+h+" .numbers",cleartypeNoBg:true})}if(psPagerStyle[h]==="numbers"){m()}else{o()}if(psAutoplay[h]===false){a("#portfolio-slideshow"+h).cycle("pause")
}else{if(psAudio[h]===true){a("#portfolio-slideshow"+h).delay(1000).queue(function(){a("#portfolio-slideshow"+h).cycle("resume");a("#slideshow-nav"+h+" a.play").fadeOut(100,function(){a("#slideshow-nav"+h+" a.pause").fadeIn(10)});a("#portfolio-slideshow"+h).parent().nextAll(".haiku-text-player:first").jPlayer("play")})}else{a("#slideshow-nav"+h+" a.play").fadeOut(100,function(){a("#slideshow-nav"+h+" a.pause").fadeIn(10)})}}a("#slideshow-nav"+h+" a.pause").click(function(){a(this).fadeOut(100,function(){a("#slideshow-nav"+h+" a.play").fadeIn(10)
});if(psAudio[h]===true){a(this).parent().parent().nextAll(".haiku-text-player:first").jPlayer("pause")}a("#portfolio-slideshow"+h).cycle("pause")});a("#slideshow-nav"+h+" a.play").click(function(){a("#portfolio-slideshow"+h).cycle("resume");a(this).fadeOut(100,function(){a("#slideshow-nav"+h+" a.pause").fadeIn(10)});if(psAudio[h]===true){a(this).parent().parent().nextAll(".haiku-text-player:first").jPlayer("play")}});a("#slideshow-nav"+h+" a.restart").click(function(){a("#pager"+h+" .numbers").empty();
a(this).fadeOut(100,function(){a("#slideshow-nav"+h+" a.pause").fadeIn(10)});if(psAudio[h]===true){a(this).parent().parent().nextAll(".haiku-text-player:first").jPlayer("play")}if(psPagerStyle[h]==="numbers"){m()}else{o()}});a(window).resize(function(){a("#portfolio-slideshow"+h).css("width","").css("height","");var q,r;q=a("#portfolio-slideshow"+h).find(".slideshow-content").eq(currSlide[h]).outerHeight();r=a("#portfolio-slideshow"+h).find(".slideshow-content").eq(currSlide[h]).width();a("#portfolio-slideshow"+h).css("height",q).css("width",r)
});a("#slideshow-wrapper"+h+".hover .slideshow-content").hover(function(){a("#portfolio-slideshow"+h+" .slideshow-meta").fadeTo("fast",1)},function(){a("#portfolio-slideshow"+h+" .slideshow-meta").fadeTo("fast",0)});a(document).keydown(function(q){if(q.which==37){a("#psprev"+h).click()}else{if(q.which==39){a("#psnext"+h).click()}}});function j(r,q){if(psPagerStyle[h]==="thumbs"){return"#pager"+h+" img:eq("+(r)+")"}if(psPagerStyle[h]==="bullets"){return"#pager"+h+" a:eq("+(r)+")"}}function p(u,r,s){tabSlide[h]=s.nextSlide+1;
var v=Math.ceil(((tabSlide[h])/psCarouselSize[h])-1);a("#carouselnav"+h+" a").eq(v).click();var q,t;q=a(this).height();t=a(r).width();a("#portfolio-slideshow"+h).height(q).width(t)}function i(v,s,t){currSlide[h]=t.currSlide;var q,u;q=a(this).height();u=a(s).width();if(ie===true){a("#portfolio-slideshow"+h).height(q).width(u)}if(psNoWrap[h]===true){if(t.currSlide===0){a("#slideshow-nav"+h+" .slideshow-prev, #slideshow-nav"+h+" .sep").addClass("inactive")}else{a("#slideshow-nav"+h+" .slideshow-prev, #slideshow-nav"+h+" .sep").removeClass("inactive")
}if(t.currSlide===t.slideCount-1){a("#slideshow-nav"+h+" .slideshow-next, #slideshow-nav"+h+" .sep").addClass("inactive")}else{a("#slideshow-nav"+h+" .slideshow-next").removeClass("inactive")}}if(e===true){window.location.hash=t.currSlide+1}var r=(t.currSlide+1)+" "+b+" "+t.slideCount;a(".slideshow-info"+h).html(r)}function k(){a("#slideshow-nav"+h+" .slideshow-next, #slideshow-nav"+h+" .sep").addClass("inactive");a("#slideshow-nav"+h+" a.pause").hide();a("#slideshow-nav"+h+" a.play").hide();a("#slideshow-nav"+h+" a.restart").show()
}})})})});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment