码迷,mamicode.com
首页 > Web开发 > 详细

JQuery 遮罩层弹窗

时间:2017-02-12 20:08:12      阅读:300      评论:0      收藏:0      [点我收藏+]

标签:osi   var   logs   click   doc   margin   use   seo   jquer   

var str = "<div id=\"zhezhao\" style=\"display:none; background-color: rgba(0,0,0,0.3); width: 100%; height: 100%; position: fixed; top: 0px; left: 0px; z-index: 9999;\">";
str += "<div id=\"tanchuang\" style=\"width: 300px; margin: auto; top:-500px; position: relative; background-color: white; box-shadow: 0px 0px 10px black; border-radius: 5px; font-family: 微软雅黑;\">";
str += "<div id=\"tc-title\" style=\"width: 100%; height: 40px; position: relative; text-indent: 15px; line-height: 40px; background-color: #808080;\"></div>";
str += "<div id=\"tc-context\" style=\"width: 100%; height: 30px; position: relative; margin-top: 20px; text-align: center; line-height: 30px; font-size: 1.3em;\"></div>";
str += "<div id=\"tc-btns\" style=\"width: 100%; height: 30px; position: relative; margin-top: 20px;\">";
str += "<div id=\"tc-btn1\" style=\"width: 80px; height: 30px; position: relative; left: 110px; background-color: red; text-align: center; line-height: 30px; color: white; font-size: 1.2em; border-radius: 5px;cursor:pointer;\">确 定</div>";
str += "</div><div style=\"width: 100%; height: 30px; position: relative;\"></div></div></div>";
document.getElementsByTagName("body")[0].innerHTML += str;


function SelfAlert(t, c) {
    $("#tc-title").text(t);
    $("#tc-context").text(c);
    $("#zhezhao").css("display", "block");
    $("#tanchuang").animate({ top: "200px" }, 300).animate({ top: "150px" }, 100).animate({ top: "200px" }, 200);
}

$("#tc-btn1").live("click", function () {
    $("#tanchuang").animate({ top: "250px" }, 200).animate({ top: "-500px" }, 300, function () {
        $("#zhezhao").css("display", "none");
    });
});

$("#tc-btn1").live("mouseover", function () {
    $(this).animate({ backgroundColor: "#890606" }, 300);
});
$("#tc-btn1").live("mouseout", function () {
    $(this).animate({ backgroundColor: "red" }, 300);
});

JS代码

JQuery 遮罩层弹窗

标签:osi   var   logs   click   doc   margin   use   seo   jquer   

原文地址:http://www.cnblogs.com/maxin991025-/p/6391560.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!