zoukankan      html  css  js  c++  java
  • 自己写的一个jquery 弹出层控制插件

    效果如下: 当鼠标移动到版主管理,显示用户管理层,位置为其下方,鼠标从该层上方移走,该层隐藏。

    jquery 类:

    代码
    /*
    * layercontrol 1.0
    * Copyright (c) 2010
    * Date: 2010-08-27
    * 层控制
    */

    (
    function($) {
    $.fn.layercontrol
    = function(options) {
    var defaults = {
    openlayerObj: options
    //隐藏层对象
    }
    var options = $.extend(defaults, options);
    this.each(function() {
    var Obj = $(this);
    $(Obj).bind(
    "mouseover", function(e) {
    var offset = $(e.target).offset();
    offset.top
    += $(this).height();
    $(
    "#" + options.openlayerObj).css(offset).show();
    // $("#" + options.openlayerObj).focus();
    // $("#ShowInfo").focus();
    // void (0);
    });
    $(
    "#" + options.openlayerObj).bind("mouseout", function(e) {
    $(
    this).css('display', 'none')
    });
    $(
    "#" + options.openlayerObj).bind("mouseover", function(e) {
    $(
    this).css('display', 'block')
    });
    // $("#" + options.openlayerObj).bind("blur", function(e) {
    //
    // $(this).css('display', 'none')
    // });
    });
    };
    })(jQuery);

    html 页面使用方法:

    代码
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title></title>

    <script src="../js/jquery-1.3.2.js" type="text/javascript"></script>

    <script src="../js/layercontrol.js" type="text/javascript"></script>

    <script type="text/javascript">
    $(document).ready(
    function() {
    $(
    "#base").layercontrol("openwindow");
    $(
    "#Div1").layercontrol("openwindow");
    });
    </script>

    </head>
    <body>
    <div id="base" style=" 100px; height: 20px; margin-top: 150px; background-color: Red;">
    信息管理
    </div>
    <div id="Div1" style=" 150px; height: 150px; margin-top: 600px; background-color: blue;">
    laldlfsaldflsadf
    </div>
    <div id="openwindow" style="position: absolute; 80px; height: 80px; background-color: Green;">
    跟随的idv
    </div>
    </body>
    </html>

     这边有个问题:如果想控制的方式为:不是从该层上移走隐藏,而是在弹出层之外的地方点击隐藏,大家有什么好的实现办法?

  • 相关阅读:
    Something I know about WebDynpro
    Details about support package implementation
    CRM Middleware Performance Topics
    Way to configure the logon navigaion layouts via Business Roles in CRM
    DOM 常用节点类型和方法
    第一届 xdef 会议日程
    去除百度音乐盒广告的chrome插件 持续更新
    从人人网抓取高校数据信息,包括,省份 高校 院系 (提供最终SQL文件下载)
    PHP 与 JSON
    解决HTTPS 发送请求走socket问题
  • 原文地址:https://www.cnblogs.com/dooom/p/1810647.html
Copyright © 2011-2022 走看看