Skip to content

Commit 884491d

Browse files
committed
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
1 parent 6c05c5e commit 884491d

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ To see this working please check http://www.tristanperry.com/lightweight-lightbo
88

99
## Install Instructions
1010

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

1313
- Include the CSS (from Styles.css) and the Javascript (from Scripts.js) in the page(s) you want the lightbox to appear in.
1414
- The JS can go anywhere on the page - in the `<head>` or within the `<body>`. The `$(function() {` notation is shorthand for `$( document ).ready()`

Scripts.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ function showLbox(url) {
22
$("#lboxinner").html('Loading image...');
33
$("#lbox").show(300);
44

5-
$('<img src="'+ url +'">').load(function() {
6-
$("#lboxinner").html('');
7-
$(this).appendTo('#lboxinner');
8-
});
5+
var img = $("<img>");
6+
img.attr("src", url);
7+
$("#lboxinner").html(img);
98
}
109

1110
function hideLbox() {

0 commit comments

Comments
 (0)