$(document).ready(function(){ //Flag for preventing multiple image displays var lb_loading = false; $(".gallery li").click(function(e){ e.preventDefault(); if(lb_loading) return false; lb_loading= true; var item = $(this); var img = item.find(".photolink"); var title = item.find(".imgtitlep").html(); var itemnumber =item.find(".artnumber").html(); //Remove active class from previously clicked LI $(".gallery li.active").removeClass("active"); //Mark the clicked LI as active for later use item.addClass("active"); //The large image var large_img = new Image(); //Use data-large or the src itself if large image url is not available large_img.src = img.attr("data-large") ? img.attr("data-large") : img.attr("href"); //Adding additional HTML - only if it hasn't been added before if($(".lb_backdrop").length < 1) { var lb_backdrop = '
'; var lb_canvas = '
'; var lb_previous = ''; var lb_title = '
'; var lb_next = ''; var lb_close = '

X CLOSE

'; var lb_controls = '
'+lb_title+'