diff options
Diffstat (limited to 'themes/hexo-theme-freemind.bithack/source/js/gallery.js')
m--------- | themes/hexo-theme-freemind.bithack | 0 | ||||
-rw-r--r-- | themes/hexo-theme-freemind.bithack/source/js/gallery.js | 1 |
2 files changed, 1 insertions, 0 deletions
diff --git a/themes/hexo-theme-freemind.bithack b/themes/hexo-theme-freemind.bithack deleted file mode 160000 -Subproject db335ebdc14507c7687084da084a56eb3d003f1 diff --git a/themes/hexo-theme-freemind.bithack/source/js/gallery.js b/themes/hexo-theme-freemind.bithack/source/js/gallery.js new file mode 100644 index 0000000..1a119a1 --- /dev/null +++ b/themes/hexo-theme-freemind.bithack/source/js/gallery.js @@ -0,0 +1 @@ +(function($){$(".content").each(function(i){$(this).find("img").each(function(){if(!$(this).hasClass("nofancybox")){var alt=this.alt;if(alt){$(this).wrap('<a href="'+this.src+'" title="'+alt+'" class="fancybox" rel="gallery'+i+'" />');}else{$(this).wrap('<a href="'+this.src+'" class="fancybox" rel="gallery'+i+'" />');}}});});var play=function(parent,item,callback){var width=parent.width();item.imagesLoaded(function(){var _this=this[0],nWidth=_this.naturalWidth,nHeight=_this.naturalHeight;callback();this.animate({opacity:1},500);parent.animate({height:width*nHeight/nWidth},500);});};$(".gallery").each(function(){var $this=$(this),current=0,photoset=$this.children(".photoset").children(),all=photoset.length,loading=true;play($this,photoset.eq(0),function(){loading=false;});$this.on("click",".prev",function(){if(!loading){var next=(current-1)%all;loading=true;play($this,photoset.eq(next),function(){photoset.eq(current).animate({opacity:0},500);loading=false;current=next;});}}).on("click",".next",function(){if(!loading){var next=(current+1)%all;loading=true;play($this,photoset.eq(next),function(){photoset.eq(current).animate({opacity:0},500);loading=false;current=next;});}});});})(jQuery);
\ No newline at end of file |