JqModal 是jQuery的一个插件,用来在web浏览器中显示自定义通告,而且它为通用窗口框架奠定了基础。

1. 多模型支持
2. 支持拖拽和重定义大小
3, 支持远程加载窗口内容(ajax和iframes)
下载:
 
使用的方法:
step1:添加js与css
<link href="css/jqModal.css" rel="stylesheet" type="text/css" />
<script src="scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="scripts/jqModal.js" type="text/javascript"></script>
<script src="scripts/jqDnR.js" type="text/javascript"></script>

 
Step2:前台HTML
<a href="#" class="jqModal">view</a>
...
<div class="jqmWindow" id="dialog">
<a href="#" class="jqmClose">Close</a>
<hr>
<em>READ ME</em> -->
This is a "vanilla plain" jqModal window. Behavior and appeareance extend far beyond this.
The demonstrations on this page will show off a few possibilites. I recommend walking
through each one to get an understanding of jqModal <em>before</em> using it.
     </div>

前台JS
<script type="text/javascript">
    $().ready(function() {
        $('#dialog').jqm();
    });
</script>

效果:
 
 
前台HTML:
<a href="#" class="ex3bTrigger">view</a> (alert)
...
<div class="jqmAlert" id="ex3b">

<div id="ex3b" class="jqmAlertWindow">
    <div class="jqmAlertTitle clearfix">
    <h1>Did you know?</h1><a href="#" class="jqmClose"><em>Close</em></a>
  </div>
 
  <div class="jqmAlertContent">
  <p>Please wait... <img src="inc/busy.gif" alt="loading" /></p>
  </div>
</div>

</div>

 
前台JS
 $().ready(function() {
var triggers = $('a.ex3bTrigger')[0];
      $('#ex3b').jqm({
            trigger: triggers,
            ajax: 'html/2.htm',
            target: 'div.jqmAlertContent',
            overlay: 0
        });
        // Close Button Highlighting. IE doesn't support :hover. Surprise?
        if ($.browser.msie) {
            $('div.jqmAlert .jqmClose')
  .hover(
    function() { $(this).addClass('jqmCloseHover'); },
    function() { $(this).removeClass('jqmCloseHover'); });
        }
    });

效果:
 
 
前台HTML
<body>
<a href="#" id="ex3aTrigger">view</a> (dialog)
...
<div id="ex3a" class="jqmDialog">
<div class="jqmdTL"><div class="jqmdTR"><div class="jqmdTC jqDrag">Dialog Title</div></div></div>
<div class="jqmdBL"><div class="jqmdBR"><div class="jqmdBC">
<div class="jqmdMSG">
Styled windows or dialogs are easy!
<br /><br />
This particular theme was done for <a href="http://www.pommo.org">poMMo</a> --
</div>
</div></div></div>
<input type="image" src="dialog/close.gif" class="jqmdX jqmClose" />
</div>
</body>
 
前台JS
<script type="text/javascript">
    $(document).ready(function() {
        $('#ex3a').jqm({
            trigger: '#ex3aTrigger',
            overlay: 30, /* 0-100 (int) : 0 is off/transparent, 100 is opaque */
            overlayClass: 'whiteOverlay'
        })
    .jqDrag('.jqDrag'); /* make dialog draggable, assign handle to title */
$('input.jqmdX')
  .hover(
    function() { $(this).addClass('jqmdXFocus'); },
    function() { $(this).removeClass('jqmdXFocus'); })
  .focus(
    function() { this.hideFocus = true; $(this).addClass('jqmdXFocus'); })
  .blur(
    function() { $(this).removeClass('jqmdXFocus'); });
    });
</script>
 
效果:
 
 
前台HTML
<body>
<a href="#" id="ex3cTrigger">view</a> (notice)
...
<div style="position: absolute; margin: 10px 0 0 100px;">
<div id="ex3c" class="jqmNotice">
    <div class="jqmnTitle jqDrag">
      <h1>Did you know?</h1>
    </div>
  <div class="jqmnContent">
  <p>Pine, spruce, or other evergreen wood should never be used in barbecues. These woods,    </p>
  </div>
  <img src="css/notice/close_icon.png" alt="close" class="jqmClose" />
  <img src="css/notice/resize.gif" alt="resize" class="jqResize" />
</div>
</div>
</body>

 
前台JS
 $().ready(function() {
        $('#ex3c')
    .jqDrag('.jqDrag')
    .jqResize('.jqResize')
    .jqm({
        trigger: '#ex3cTrigger',
        overlay: 0,
        onShow: function(h) {
            /* callback executed when a trigger click. Show notice */
            h.w.css('opacity', 0.92).slideDown();
        },
        onHide: function(h) {
            /* callback executed on window hide. Hide notice, overlay. */
            h.w.slideUp("slow", function() { if (h.o) h.o.remove(); });
        }
    });
    });
 
效果:
 
前台HTML
<body>
<a href="#" class="ex2trigger">View</a>
...
<div class="jqmWindow" id="ex2">

Please wait... <img src="inc/busy.gif" alt="loading" />
</div>
</body>

 
前台JS
<script type="text/javascript">
    $(document).ready(function() {
        $('#ex2').jqm({ ajax: 'html/1.htm', trigger: 'a.ex2trigger' });
    });
</script>

效果:
 
前台HTML
<body>
<a href="#" class="alert">view</a> (alert)
<a href="#" class="confirm">view</a> (confirm)
...
<!-- Alert Dialog -->
<div class="jqmAlert" id="alert">
<div id="ex3b" class="jqmAlertWindow">
    <div class="jqmAlertTitle clearfix">
    <h1>Warning!</h1><a href="#" class="jqmClose"><em>Close</em></a>
  </div>
  <div class="jqmAlertContent"></div>
</div>
</div>
 
<!-- Confirm Dialog -->
<div class="jqmConfirm" id="confirm">
<div id="ex3b" class="jqmConfirmWindow">
    <div class="jqmConfirmTitle clearfix">
    <h1>Confirmation por favor...</h1><a href="#" class="jqmClose"><em>Close</em></a>
  </div>
  <div class="jqmConfirmContent">
  <p class="jqmConfirmMsg"></p>
  <p>Continue?</p>
  </div>
  <input type="submit" value="no" />
  <input type="submit" value="yes" />
  </p>
</div>
</div>
</body>

 
<script type="text/javascript">
    /* Overriding Javascript's Alert Dialog */
    function alert(msg) {
        $('#alert')
    .jqmShow()
    .find('div.jqmAlertContent')
      .html(msg);
    }
    $().ready(function() {
        $('#alert').jqm({ overlay: 0, modal: true, trigger: false });
        // trigger an alert whenever links of class alert are pressed.
        $('a.alert').click(function() {
            alert('You Have triggered an alert!');
            return false;
        });
    });

function confirm(msg, callback) {
        $('#confirm')
    .jqmShow()
    .find('p.jqmConfirmMsg')
      .html(msg)
    .end()
    .find(':submit:visible')
      .click(function() {
          if (this.value == 'yes')
              (typeof callback == 'string') ?
            window.location.href = callback :
            callback();
          $('#confirm').jqmHide();
      });
    }
    $().ready(function() {
        $('#confirm').jqm({ overlay: 88, modal: true, trigger: false });
        // trigger a confirm whenever links of class alert are pressed.
        $('a.confirm').click(function() {
            confirm('About to visit: ' + this.href + ' !', this.href);
            return false;
        });
    });
</script>

 
效果:

JQuery插件jqModal应用详解(十二)的更多相关文章

  1. jQuery插件制作方法详解

        jQuery插件制作方法详解   jquery插件给我的感觉清一色的清洁,简单.如Jtip,要使用它的功能,只需要在你的元素的class上加 上Jtip,并引入jtip.js及其样式即可以了. ...

  2. jQuery插件编写步骤详解

    如今做web开发,jquery 几乎是必不可少的,就连vs神器在2010版本开始将Jquery 及ui 内置web项目里了.至于使用jquery好处这里就不再赘述了,用过的都知道.今天我们来讨论下jq ...

  3. jQuery插件- Autocomplete应用详解

    项目中有时会用到自动补全查询,就像Google搜索框.淘宝商品搜索功能,输入汉字或字母,则以该汉字或字母开头的相关条目会显示出来供用户选择, autocomplete插件就是完成这样的功能. auto ...

  4. jQuery插件autoComplete使用详解

    安装/需要引入的文件 <script type="text/javascript" src="../js/jquery-1.8.3.min.js.js"& ...

  5. jQuery的deferred对象详解(二)

    Deferred对象是由$.Deferred构造的,$.Deferred被实现为简单的工厂模式. $.Deferred的实现 创建三个$.Callbacks对象,分别表示成功done,失败fail,处 ...

  6. Nginx详解十二:Nginx场景实践篇之跨站访问相关

    跨站访问 浏览器请求一个页面的时候,发送了两个域名的请求 此情况不安全,容易出现CSRF攻击,所以浏览器禁止跨域访问 Nginx设置打开跨站访问 配置语法:add_header name value ...

  7. Linux 网络编程详解十二

    UDP的特点 --无连接 --基于消息的数据传输服务 --不可靠 --UDP更加高效 UDP注意点 --UDP报文可能会丢失,重复 --UDP报文可能会乱序 --UDP缺乏流量控制(UDP缓冲区写满之 ...

  8. 【转】JQuery上传插件Uploadify使用详解及错误处理

    转自:http://www.jb51.net/article/43498.htm 关于JQuery上传插件Uploadify使用详解网上一大把,基本上内容都一样.我根据网上的步骤配置完成后,会报一些错 ...

  9. CMake 手册详解(二十)

    SirDigit CMake 手册详解(二十) CMD#51: list 列表操作命令. list(LENGTH <list> <output variable>) list( ...

随机推荐

  1. 6、Python-元组

    定义 # Python的元组与列表类似,不同之处在于元组的元素不能修改.元组使用小括号,列表使用方括号. aTuple = ('et',77,99.9) print(aTuple) 元组的操作 aTu ...

  2. 图解项目管理流程:禅道&JIRA中的操作

    禅道作为优秀的国产开源项目管理软件,禅道集产品管理.项目管理.质量管理.文档管理.组织管理和事务管理于一体,完整覆盖了研发项目管理的核心流程.禅道的设计理念在于提供一体化的解决方案,流程图完整呈现了项 ...

  3. Ubuntu 下 Tomcat7 的安装和配置

    tomcat下载地址:http://tomcat.apache.org/download-70.cgi 声明:下面的内容和原创笔者的博文的内容差不多,不一样的只是tomcat7的安装目录不同,我按照我 ...

  4. TCP粘包,拆包及解决方法

    在进行Java NIO学习时,发现,如果客户端连续不断的向服务端发送数据包时,服务端接收的数据会出现两个数据包粘在一起的情况,这就是TCP协议中经常会遇到的粘包以及拆包的问题.我们都知道TCP属于传输 ...

  5. linux的基本操作与常见命令

    linux的基本操作与常见命令: jdk的安装: 步骤:(特别注意:虚拟机安装的一般是32位的操作系统,jdk也必须使用32位的) 查看虚拟机版本:sudo uname --m i686 //表示是3 ...

  6. FlowLayout OnSizeChanged

    在FlowLayout里加了20个控件,当窗口变化时,改变这20个控件的宽高,结果发现在直接点最大化时, 计算不正确导致自身的滚动条出不来.把改变大小的代码直接添加Form窗口的onSizeChagn ...

  7. luogu 1052 过河

    神仙的博客,先copy了日后绝对删掉的,(因为我实在没耐心看懂啊..) 题解 step 1理解题意 在做这道题之前,一定要理解好题意,有一个需要特别注意注意的地方: 青蛙不是一定要跳到石头上[嗯... ...

  8. 数据库之MySQL ERROR 1698 (28000) 错误:Access denied for user 'root'@'localhost'" error【摘抄】

    声明:全文均摘抄于MySQL ERROR 1698 (28000) 错误 //错误起源: ~$ mysql -u root -p Enter password: ERROR 1698 (28000): ...

  9. Java SE之For增强与Iterator遍历器提取数据(附Map.Entry)

    增强for循环: 1.操作数组 2.操作List集合 3.操作Map集合    1.map.values()法    2.map.keySet()法  [传统方法]    3.Map.Entry法   ...

  10. CSS进阶之模拟Bootstrap网格布局

    目前暂时实现效果,容后面整理心得,先贴上源代码. 源码 <!DOCTYPE html> <html> <head> <title>demo bootst ...