zoukankan      html  css  js  c++  java
  • JQuery------制作div模态框

    转载:

    http://blog.csdn.net/li_xiao_ming/article/details/6738922

    如图:

    代码:

    html(使用opacity的话content无法变为不透明,所有这里使用了background:rgba(0,0,0,0.3))属性来设置透明

    <button class = 'btn'>点击显示</button>
    <div class = "bg-model" style="position:absolute;top:0%;left:0%;display:none;background:rgba(0,0,0,0.3);100%;height:100%;position:fixed;z-index:9999">
      <div class = 'content' style="position: absolute;left: 35%;top: 25%;border-radius: 8px; 30%;height: 40%;background-color: #fff;">
      </div>
    </div>

    js

    //加入购物车点击事件
    $(".cart-add").click(function () {
      $(".bg-model").fadeTo(300,1)
      //隐藏窗体的滚动条
      $("body").css({ "overflow": "hidden" });
    });
    
    //模态框OK按钮点击事件
    $(".bg-model-ok").click(function () {
      $(".bg-model").hide();
      //显示窗体的滚动条
      $("body").css({ "overflow": "visible" });
    }).hover(function () {
      $(this).css({ "backgroundColor": "#8CC8C8" });
    }, function () {
      $(this).css({ "backgroundColor": "#8CD4E6" });
    });
  • 相关阅读:
    ①---Java开发环境配置
    1.java的基础和数据类型
    0、原生jdbc工厂类
    spring中使用quartz动态添加定时任务执行sql
    app前端代码打包步骤
    less的解析笔记
    转:玩转HTML5移动页面(动效篇)
    HTML5属性备忘单
    玩转git和github
    js基础----数组
  • 原文地址:https://www.cnblogs.com/tianhengblogs/p/6377379.html
Copyright © 2011-2022 走看看