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,27 +120,11 @@ 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');
// set the related anchor
$modal.data('anchor', $this);
if($modal.data('state') == 'showing') {
$this.trigger('close.mw');
} else {
$this.trigger('open.mw');
}
return false;
})
.bind('init.mw', function(){
var $this = $(this), $modal, $btnClose;
$modal = $( $this.attr('href') );
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') });
@ -152,9 +136,18 @@ jQuery(function($){
.append($btnClose.clone(true))
.end()
.appendTo('body');
}
// unbind create event
$this.unbind('init.mw');
// set the related anchor
$modal.data('anchor', $this);
if($modal.data('state') == 'showing') {
$this.trigger('close.mw');
} else {
$this.trigger('open.mw');
}
return false;
})
.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(){