Fixed a bug for repeating initialization. Adjust fog layer's height

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8868 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
taggon 2011-08-24 09:29:58 +00:00
parent 9462e2c9d9
commit bd0b64c1a3

View file

@ -120,11 +120,23 @@ jQuery(function($){
// Modal Window
$('a.modalAnchor')
.click(function(){
var $this = $(this), $modal, disabled;
var $this = $(this), $modal, $btnClose, disabled;
// get and initialize modal window
$modal = $( $this.attr('href') );
$this.trigger('init.mw');
if(!$modal.parent('body').length) {
$btnClose = $('<button type="button" class="modalClose" title="Close this layer">X</button>');
$btnClose.click(function(){ $modal.data('anchor').trigger('close.mw') });
$modal
.prepend('<span class="bg"></span>')
.append('<!--[if IE 6]><iframe class="ie6"></iframe><![endif]-->')
.find('>.fg')
.prepend($btnClose)
.append($btnClose.clone(true))
.end()
.appendTo('body');
}
// set the related anchor
$modal.data('anchor', $this);
@ -137,25 +149,6 @@ jQuery(function($){
return false;
})
.bind('init.mw', function(){
var $this = $(this), $modal, $btnClose;
$modal = $( $this.attr('href') );
$btnClose = $('<button type="button" class="modalClose" title="Close this layer">X</button>');
$btnClose.click(function(){ $modal.data('anchor').trigger('close.mw') });
$modal
.prepend('<span class="bg"></span>')
.append('<!--[if IE 6]><iframe class="ie6"></iframe><![endif]-->')
.find('>.fg')
.prepend($btnClose)
.append($btnClose.clone(true))
.end()
.appendTo('body');
// unbind create event
$this.unbind('init.mw');
})
.bind('open.mw', function(){
var $this = $(this), before_event, $modal, duration;
@ -190,6 +183,7 @@ jQuery(function($){
$modal
.fadeIn(duration, after)
.find('>.bg').height($(document).height()).end()
.find('button.modalClose:first').focus();
})
.bind('close.mw', function(){