日期:2014-05-16  浏览次数:20428 次

jquery.boxy.js select ie6下无法遮住的bug

[code="js"]// Returns true if this dialog is visible, false otherwise
??? isVisible: function() {
??????? return this.visible;
??? },
//-------------------------------------
? //弹层大小会改变时会用到这个方法,Boxy.get(this).auto_resize();

??? auto_resize:function(){

??????? if (this.options.useIframe == true) {
??????????? this.temp_iframe.width(this.getSize()[0]);

??????????? this.temp_iframe.height(this.getSize()[1]);
??????????? this.temp_iframe.css({left:this.getPosition()[0],
??????? top:this.getPosition()[1]});
??????? }
??? },

//-------------------------------------

上面加粗的是 新增的方法

修改show 和hide方法

[code="js"]show: function() {
??????? if (this.visible) return;
??????? if (this.options.modal) {
??????????? var self = this;
??????????? Boxy._setupModalResizing();
??????????? this.modalBlackout = jQuery('')
??????????????? .css(jQuery.extend(Boxy._cssForOverlay(), {
??????????????????? zIndex: Boxy._nextZ(), opacity: Boxy.MODAL_OPACITY
??????????????? })).appendTo(document.body);
??????????? this.toTop();
??????????? if (this.options.closeable) {
??????????????? jQuery(document.body).bind('keypress.boxy', function(evt) {
??????????????????? var key = evt.which || evt.keyCode;
??????????????????? if (key == 27) {
??????????????????????? self.hide();
??????????????????????? jQuery(document.body).unbind('keypress.boxy');
??????????????????? }
??????????????? });
??????????? }
??????? }

this.getInner().stop().css({width: '', height: ''});

//-------------------------------------
if(this.options.useIframe == true)
{
????? var ifreamWidth = this.getSize()[0];
???? var ifreamHeight = this.boxy.height();?
?????

?????this.temp_iframe = jQuery('<div style="background-color: #f00;position:absolute"><iframe style="width:'+ifreamWidth+'px; height:'+ifreamHeight+'px " frameborder="0"></iframe></div>').css({
??????? zIndex:Boxy._nextZ()

??????? });
this.temp_iframe.appendTo(document.body);
this.toTop();
}
//-------------------------------------



??????? this.boxy.stop().css({opacity: 1}).show();
??????? this.visible = true;
??????? this.boxy.find('.close:first').focus();
??????? this._fire('afterShow');
?????? this.auto_resize();
??????? return this;
??? },

??? // Hide this boxy instance
??? hide: function(after) {

if (!this.visible) return;

var self = this;

if (this.options.modal) {
??????????? jQuery(document.body).unbind('keypress.boxy');
??????????? this.modalBlackout.animate({opacity: 0}, function() {
??????????????? jQuery(this).remove();
??????????? });
??????? }
//-------------------------------------
if(this.options.useIframe == true)
{
this.temp_iframe.animate({opacity: 0}, function() {
??????????????? jQuery(this).remove();
??????????? });
//-------------------------------------

}

var target = { boxy: {}, inner: {} },
tween = 0,
hideComplete = function() {
self.boxy.css({display: 'none'});
self.visible = false;
self._fire('afterHide');
if (after) after(self);
if (self.options.unloadOnHide) self.unload();
};

if (this.options.hideShrink) {
var inner = this.getInner(), hs = this.options.hideShrink, pos = this.getPosition();
tween |= 1;
if (hs === true || hs == 'vertical') {
target.inner.height = 0;
target.boxy.top = pos[1] + inner.height() / 2;
}
if (hs === true || hs == 'horizontal') {
target.inner.width = 0;
target.boxy.left = pos[0] + inner.width() / 2;
}
}

if (this.options.hideFade) {
tween |= 2;
target.boxy.opacity = 0;
}

if