Skip to content

Commit 0f3ce9c

Browse files
committed
Bug Fixes: Prevented creating duplicate windows / Added: OpenViewer method for custom calls
1 parent 158ff90 commit 0f3ce9c

2 files changed

Lines changed: 24 additions & 7 deletions

File tree

js/jquery.lbt-lightbox.js

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* LBT Lightbox v1.0.9
2+
* LBT Lightbox v1.1.2
33
* by Jean Kássio
44
*
55
* More info:
@@ -134,16 +134,14 @@
134134

135135
$(document).on('click', options.lbt_id + " #lbt-close_lightbox", function(e){
136136

137-
$("body").removeClass("lbr-ToFixed");
138-
$("#lbt-lightbox_imgs", options.container_lightbox).remove();
137+
RemoveViewer();
139138

140139
});
141140

142141
$(document).keyup(function(e){
143142

144143
if(e.key === "Escape"){
145-
$("body").removeClass("lbr-ToFixed");
146-
$("#lbt-lightbox_imgs", options.container_lightbox).remove();
144+
RemoveViewer();
147145
}else if(e.key === "ArrowRight"){
148146
NextImage();
149147
}else if(e.key === "ArrowLeft"){
@@ -323,6 +321,16 @@
323321

324322
}
325323

324+
$.fn.OpenViewer = function(obj){
325+
326+
MountViewer(obj);
327+
LoadMedia($(obj).index(options.custom_children), null);
328+
MountThumbs(obj, "#lbt-thumbnails");
329+
ToLeft();
330+
$("body").addClass("lbr-ToFixed");
331+
UpdateArrows();
332+
}
333+
326334
$.fn.update = function(){
327335

328336
GetIframeVideos();
@@ -580,8 +588,17 @@
580588

581589
}
582590

591+
function RemoveViewer(){
592+
593+
$("body").removeClass("lbr-ToFixed");
594+
$("#lbt-lightbox_imgs", options.container_lightbox).remove();
595+
596+
}
597+
583598
function MountViewer(obj){
584599

600+
RemoveViewer();
601+
585602
$(options.container_lightbox).append([
586603
$('<div/>',{"id": "lbt-lightbox_imgs"}).append([
587604
$('<div/>',{"id": "lbt_previous"}).append([

0 commit comments

Comments
 (0)