You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

superbox.min.js 1.5KB

1
  1. !function(a){a.fn.SuperBox=function(b){var c=a('<div class="superbox-show"></div>'),d=a('<img src="" class="superbox-current-img"><div id="imgInfoBox" class="superbox-imageinfo inline-block"> <h1>Image Title</h1><span><p><em>http://imagelink.com/thisimage.jpg</em></p><p class="superbox-img-description">Image description</p><p><a href="javascript:void(0);" class="btn btn-primary btn-sm">Edit Image</a> <a href="javascript:void(0);" class="btn btn-danger btn-sm">Delete</a></p></span> </div>'),e=a('<div class="superbox-close txt-color-white"><i class="fa fa-times fa-lg"></i></div>');c.append(d).append(e);a(".superbox-imageinfo");return this.each(function(){a(".superbox-list").click(function(){$this=a(this);var b=$this.find(".superbox-img"),e=b.data("img"),f=b.attr("alt")||"No description",g=e,h=b.attr("title")||"No Title";d.attr("src",e),a(".superbox-list").removeClass("active"),$this.addClass("active"),d.find("em").text(g),d.find(">:first-child").text(h),d.find(".superbox-img-description").text(f),0==a(".superbox-current-img").css("opacity")&&a(".superbox-current-img").animate({"opacity":1}),a(this).next().hasClass("superbox-show")?(c.is(":visible")&&a(".superbox-list").removeClass("active"),c.toggle()):(c.insertAfter(this).css("display","block"),$this.addClass("active")),a("html, body").animate({"scrollTop":c.position().top-b.width()},"medium")}),a(".superbox").on("click",".superbox-close",function(){a(".superbox-list").removeClass("active"),a(".superbox-current-img").animate({"opacity":0},200,function(){a(".superbox-show").slideUp()})})})}}(jQuery);