在控件处弹出层

//品牌地标弹出层
(function($){
$.fn.bgIframe = $.fn.bgiframe = function(s) {
    if ( $.browser.msie && /6.0/.test(navigator.userAgent) ) {
        s = $.extend({
            top     : 'auto', // auto == .currentStyle.borderTopWidth
            left    : 'auto', // auto == .currentStyle.borderLeftWidth
            width   : 'auto', // auto == offsetWidth
            height  : 'auto', // auto == offsetHeight
            opacity : true,
            src     : 'javascript:false;'
        }, s || {});
        var prop = function(n){return n&&n.constructor==Number?n+'px':n;},
            html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+
                       'style="display:block;position:absolute;z-index:-1;'+
                           (s.opacity !== false?'filter:Alpha(Opacity=\'0\');':'')+
                           'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+
                           'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+
                           'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+
                           'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+
                    '"/>';
            
        return this.each(function() {
            if ( $('> iframe.bgiframe', this).length == 0 )
                this.insertBefore( document.createElement(html), this.firstChild );
        });
    }
    return this;
};
})(jQuery);
jQuery.fn.selectCity = function(targetId) {
    var _seft = this;
    var targetId = $(targetId);
    this.click(function(){
        var A_top = $(this).offset().top + $(this).outerHeight(true);  //  1
        var A_left =  $(this).offset().left;
        targetId.bgiframe();
        targetId.show().css({"position":"absolute","top":A_top+"px" ,"left":A_left+"px"});
    });
    targetId.find(".tagClose").click(function(){
        targetId.hide();
    });
    $(document).click(function(event){
        if(event.target.id!=_seft.selector.substring(1)){
            targetId.hide();    
        }
    });
    targetId.click(function(e){
        e.stopPropagation(); //  2
    });
    return this;
}
$("#txtName").selectCity("#questionTypeDivBox");

 

原来上面那段代码就是jquery.bgiframe.js。可以让弹出层在选择框之上显示。Jquery.fn.selectCity这个点击外面弹出层就消失的代码。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值