Update to Lightweight jQuery Lightbox – For jQuery V3

Back in 2014, I knocked up a simple jQuery image lightbox script based on jQuery V1. However this script now needs a slight tweak to work for V3, hence the final script has been updated at http://www.tristanperry.com/lightweight-lightbox/, and also on GitHub

The only change is due to a change in jQuery 3’s breaking change to the load() function signature, and hence the following code in Scripts.js:

$('<img src="'+ url +'">').load(function() {
    $("#lboxinner").html('');
    $(this).appendTo('#lboxinner');
});

Now needs to be:

var img = $("<img>");
img.attr("src", url);
$("#lboxinner").html(img);
View on GitHub
View on GitHub

Leave a Comment