日前做了一个弹出层小插件,发布出来~~

 

jQuery(function($) {
    
var from;
    $.fn.opendialog 
= function(a) {
    from 
= $(this);

    
var doc = document;
    
var docElement = doc.documentElement;
    
var sHeight = docElement.clientHeight;
    
var dH = docElement.scrollHeight > sHeight ? docElement.scrollHeight : sHeight;
    
var scH = docElement.scrollTop >= 0 ? (docElement.scrollTop + sHeight / 2) : sHeight;
     hValue 
= scH - $(this)[0].clientHeight / 2;
     wValue 
= docElement.clientWidth / 2 - $(this)[0].clientWidth / 2;
        
var o = { overlay: true, bgColor: '#ffffff', opacity: 0.5,h:hValue,w:wValue, iw: $(this).attr('width'), ih: $(this).attr('height') };
        
if (a) {
            $.extend(o, a);
            
if ($("#Msgdiv").length == 0) {
                
var str = '';
                
if ($.browser.msie) {
                    str 
+= '<iframe >) {
            from.hideDiv();
        }
    }
});

 

调用方法:

 $('#ID名字).opendialog(参数);

记录点点滴滴,技术永无止境

相关文章: