Skip to content
Permalink
Browse files

Update to work for JQuery V3

Update to reflect breaking changes to JQuery V3's load() function signature, as outlined in https://www.tristanperry.com/jquery/2017/12/20/lightbox-update-jquery3.html
  • Loading branch information...
TristanPerry committed Dec 20, 2017
1 parent 6c05c5e commit 884491dccb111ed4e90f1be6cab5af48a485e2bd
Showing with 4 additions and 5 deletions.
  1. +1 −1 README.md
  2. +3 −4 Scripts.js
@@ -8,7 +8,7 @@ To see this working please check http://www.tristanperry.com/lightweight-lightbo

## Install Instructions

- Ensure that JQuery (v1.x) is referenced
- Ensure that JQuery (v3.x) is referenced

- Include the CSS (from Styles.css) and the Javascript (from Scripts.js) in the page(s) you want the lightbox to appear in.
- The JS can go anywhere on the page - in the `<head>` or within the `<body>`. The `$(function() {` notation is shorthand for `$( document ).ready()`
@@ -2,10 +2,9 @@ function showLbox(url) {
$("#lboxinner").html('Loading image...');
$("#lbox").show(300);

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

function hideLbox() {

0 comments on commit 884491d

Please sign in to comment.
You can’t perform that action at this time.