/** * @author James Simpson * Website: http://www.jsblogstop.com */ var jsBloggerLightBox = function(){ var $lightbox, $lightboxImg, linkImg = function(){ var $img = $(this), $parent = $img.parent(); if ($parent[0].nodeName == "A" && ($parent.attr("href").search("blogspot.com") != -1 || $parent.attr("href").search("googleusercontent.com") != -1)) {//Link around an Image $img.attr("title", "Click to View Full Size"); $img.attr("data-enlarge-src", $parent.attr("href")); $img.click(jsBloggerLightBox.show); $parent.attr("href", "javascript:void(0);"); //$parent.attr("href", "javascript:jsBloggerLightBox.lightbox('" + $parent.attr("href") + "');"); } }; this.init = function(){ $("body").prepend("
Close
"); var style = ""; $("head").append(style); $lightbox = $("#js-lightbox"); $lightboxImg = $("#js-lightboxImg"); $("#js-lightbox-close").click(function(){ $lightbox.fadeOut(); }); $(".post-body img").each(linkImg); }; this.show = function(){ $lightboxImg.attr("src", $(this).attr("data-enlarge-src")); $lightbox.fadeIn(); }; $(document).ready(this.init); return this; }();