zoukankan      html  css  js  c++  java
  • jQuery弹出层插件

    下载:SDialog_1.0.rar

      1 (function($){
      2     $.SDialog={
      3         show:function(o){
      4             var set ={
      5                 obj:null,
      6                 mask:true
      7             };
      8             set =$.extend(set,o||{});
      9             this.pos(set.obj);
     10             if(set.mask) this.maskShow();
     11         },
     12         hide:function(o){
     13             o.hide();
     14             if(!$('.SDialog:visible').length) this.maskHide();
     15         },
     16         hideAll:function(){
     17             this.maskHide();
     18             $(".SDialog").hide();
     19         },
     20         open:function(o){
     21             var set={
     22                 title:"",
     23                 html:"",
     24                 url:"",
     25                 500,
     26                 height:null,
     27                 mask:true,
     28                 cap:true
     29             };
     30             set =$.extend(set,o||{});
     31             if(set.url) 
     32             {
     33                 set.html='<iframe src="'+set.url+'" width="100%" height="'+set.height+'px" frameborder="0" scrolling="auto"></iframe>'; 
     34                 set.height=null;
     35             }
     36             var $win=$('<div class="SWindow">');
     37             $('body').append($win.append('<div class="SCap"><b></b><span class="SClose"></span></div><div class="SBox"></div>'));
     38             $win.css({"width":(set.width+"px"),"height":(set.height+"px")}).find(".SCap b").html(set.title);
     39             if(set.cap)$win.show().find(".SBox").html(set.html); else $win.html(set.html).attr("class","SWindow2");
     40             this.pos($win).find('.SClose').click(function(){$.SDialog.hide($win);});
     41             if(set.mask) this.maskShow();
     42         },
     43         load:function(){
     44             this.open({
     45                 html:'<div class="SLoad"></div>',
     46                 58,
     47                 height:10,
     48                 cap:false
     49             });
     50         },
     51         loadHode:function(){
     52             this.hide($(".SLoad").parent());
     53         },
     54         maskShow:function(){
     55             var s=this;
     56             var $mask = $('.SDMask');
     57             if(!$mask.length){
     58                 $mask = $('<div class="SDMask"></div>');
     59                 $('body').append($mask);
     60             }
     61             if(this.isIe6()) $('select').not($(".SDialog").find("select")).hide();
     62             $mask.height(this.docHeight).show().dblclick(function(){
     63                 s.hideAll();
     64             });            
     65         },
     66         maskHide:function(){
     67             if($('.SDMask').is(":visible")){
     68                 $('.SDMask').hide()
     69                 if(this.isIe6()) $('select').show();
     70             }        
     71         },
     72         pos:function(o){
     73             o.addClass("SDialog").css({'position':'fixed','top':'50%','left':'50%','marginTop':(-Math.floor(o.height()/2)-10),'marginLeft':-Math.floor(o.width())/2}).show();
     74             if(this.isIe6())o.css({'position':'absolute','top':($(window).scrollTop()+$(window).height()/2)}); 
     75             return o;
     76         },
     77         docHeight: function () {
     78             var scrollHeight,
     79             offsetHeight;
     80             if ($.browser.msie) {
     81                 scrollHeight = Math.max(
     82                     document.documentElement.scrollHeight,
     83                     document.body.scrollHeight
     84                 );
     85                 offsetHeight = Math.max(
     86                     document.documentElement.offsetHeight,
     87                     document.body.offsetHeight
     88                 );
     89 
     90                 if (scrollHeight < offsetHeight) {
     91                     return $(window).height() + 'px';
     92                 } else {
     93                     return scrollHeight + 'px';
     94                 }
     95             } else {
     96                 return $(document).height() + 'px';
     97             }
     98         },
     99         isIe6:function(){
    100             return (typeof document.body.style.maxHeight == "undefined");
    101         }
    102     }
    103 })(jQuery)
  • 相关阅读:
    arm SecurCore 处理器【转】
    ARM内核全解析,从ARM7,ARM9到Cortex-A7,A8,A9,A12,A15到Cortex-A53,A57【转】
    arm处理器中a5 a8 a9,v6 v7,arm7 arm9 arm11都是依据什么来分类的【转】
    platform型设备在/dev目录下自动创建设备节点的分析【转】
    linux下bus、devices和platform的基础模型 【转】
    kernel 中 sscanf和sprintf()函数使用说明【转】
    Linux内核中的printf实现【转】
    sprintf,snprintf的用法(可以作为linux中itoa函数的补充)【转】
    Linux设备模型(3)_Uevent【转】
    Linux内核中的GPIO系统之(3):pin controller driver代码分析--devm_kzalloc使用【转】
  • 原文地址:https://www.cnblogs.com/hack0573/p/4180776.html
Copyright © 2011-2022 走看看