@@ -27,30 +27,31 @@ PrimeFaces.widget.LightBox = PrimeFaces.widget.BaseWidget.extend({
2727 this . links . data ( 'primefaces-lightbox-trigger' , true ) . find ( '*' ) . data ( 'primefaces-lightbox-trigger' , true ) ;
2828 } ,
2929
30+ //@override
3031 refresh : function ( cfg ) {
31- $ ( PrimeFaces . escapeClientId ( cfg . id ) + '_panel' ) . remove ( ) ;
32+ PrimeFaces . utils . removeDynamicOverlay ( this , this . panel , this . id + '_panel' , $ ( document . body ) ) ;
3233
3334 this . init ( cfg ) ;
3435 } ,
3536
37+ //@override
3638 destroy : function ( ) {
37- this . panel . remove ( ) ;
39+ PrimeFaces . utils . removeDynamicOverlay ( this , this . panel , this . id + '_panel' , $ ( document . body ) ) ;
3840 } ,
3941
4042 createPanel : function ( ) {
41- var dom = '<div id="' + this . id + '_panel" class="ui-lightbox ui-widget ui-helper-hidden ui-corner-all ui-shadow">' ;
42- dom += '<div class="ui-lightbox-content-wrapper">' ;
43- dom += '<a class="ui-state-default ui-lightbox-nav-left ui-corner-right ui-helper-hidden"><span class="ui-icon ui-icon-carat-1-w">go</span></a>' ;
44- dom += '<div class="ui-lightbox-content ui-corner-all"></div>' ;
45- dom += '<a class="ui-state-default ui-lightbox-nav-right ui-corner-left ui-helper-hidden"><span class="ui-icon ui-icon-carat-1-e">go</span></a>' ;
46- dom += '</div>' ;
47- dom += '<div class="ui-lightbox-caption ui-widget-header"><span class="ui-lightbox-caption-text"></span>' ;
48- dom += '<a class="ui-lightbox-close ui-corner-all" href="#"><span class="ui-icon ui-icon-closethick"></span></a><div style="clear:both" /></div>' ;
49- dom += '</div>' ;
50-
51- $ ( document . body ) . append ( dom ) ;
52-
53- this . panel = $ ( this . jqId + '_panel' ) ;
43+ this . panel = $ ( '<div id="' + this . id + '_panel" class="ui-lightbox ui-widget ui-helper-hidden ui-corner-all ui-shadow">'
44+ + '<div class="ui-lightbox-content-wrapper">'
45+ + '<a class="ui-state-default ui-lightbox-nav-left ui-corner-right ui-helper-hidden"><span class="ui-icon ui-icon-carat-1-w">go</span></a>'
46+ + '<div class="ui-lightbox-content ui-corner-all"></div>'
47+ + '<a class="ui-state-default ui-lightbox-nav-right ui-corner-left ui-helper-hidden"><span class="ui-icon ui-icon-carat-1-e">go</span></a>'
48+ + '</div>'
49+ + '<div class="ui-lightbox-caption ui-widget-header"><span class="ui-lightbox-caption-text"></span>'
50+ + '<a class="ui-lightbox-close ui-corner-all" href="#"><span class="ui-icon ui-icon-closethick"></span></a><div style="clear:both" /></div>'
51+ + '</div>' ) ;
52+
53+ this . panel . appendTo ( $ ( document . body ) ) ;
54+
5455 this . contentWrapper = this . panel . children ( '.ui-lightbox-content-wrapper' ) ;
5556 this . content = this . contentWrapper . children ( '.ui-lightbox-content' ) ;
5657 this . caption = this . panel . children ( '.ui-lightbox-caption' ) ;
@@ -304,7 +305,7 @@ PrimeFaces.widget.LightBox = PrimeFaces.widget.BaseWidget.extend({
304305
305306 this . panel . css ( 'z-index' , ++ PrimeFaces . zindex ) . show ( ) ;
306307
307- if ( ! this . isModalActive ( ) ) {
308+ if ( ! PrimeFaces . utils . isModalActive ( this . id ) ) {
308309 this . enableModality ( ) ;
309310 }
310311
@@ -340,20 +341,11 @@ PrimeFaces.widget.LightBox = PrimeFaces.widget.BaseWidget.extend({
340341 } ,
341342
342343 enableModality : function ( ) {
343- $ ( document . body ) . append ( '<div id="' + this . id + '_modal" class="ui-widget-overlay"></div>' ) .
344- children ( this . jqId + '_modal' ) . css ( {
345- 'width' : $ ( document ) . width ( )
346- , 'height' : $ ( document ) . height ( )
347- , 'z-index' : this . panel . css ( 'z-index' ) - 1
348- } ) ;
344+ PrimeFaces . utils . addModal ( this . id , this . panel . css ( 'z-index' ) - 1 ) ;
349345 } ,
350346
351347 disableModality : function ( ) {
352- $ ( document . body ) . children ( this . jqId + '_modal' ) . remove ( ) ;
353- } ,
354-
355- isModalActive : function ( ) {
356- return $ ( document . body ) . children ( this . jqId + '_modal' ) . length === 1 ;
348+ PrimeFaces . utils . removeModal ( this . id ) ;
357349 } ,
358350
359351 showNavigators : function ( ) {
0 commit comments