pop弹窗

** PopFn  //弹窗,第一个参数是显示的文字(可以是HTML代码),第二和第三个参数是第一个按钮,和按钮的链接(可以是javascript函数),第四和第五个按钮是同上。如不需要右上方的关闭按钮,添加最后一个参数"noclose";
** PopFnClose  关闭弹窗函数

function PopFn(){
    var arr=[];
    arr.push("<div class='PopMark'></div>")
    arr.push("<div class='Pop' style='display:none;'>")
        arr.push("<div class='Pop_title'>")
            arr.push("<span class='title'>提示信息</span>")
            arr.push("<span class='close'>×</span>")    
        arr.push("</div>")
        arr.push("<div class='popNr'>")
            arr.push("<div class='popcon'></div>")
            arr.push("<div class='popBtn'>")
                arr.push("<a href='' class='btnFirst'></a>&nbsp;&nbsp;")
                arr.push("<a href='' class='btnSecond'></a>")
            arr.push("</div>")
        arr.push("</div>")
    arr.push("</div>")
    $("body").append($(arr.join("")))
    $(".Pop_title .close").click(function(){
        PopFnClose()
    });    
    if(arguments[arguments.length-1]=="noclose"){
        $(".Pop_title .close").css("display","none")
    }else{
        $(".Pop_title .close").css("display","block")
    }
    $(".PopMark").css({"display":"block","width":$(document).width()+"px","height":$(document).height()+"px"}).animate({opacity:"0.5"},200);
    $(".Pop").css({"top":"300px","left":($(window).width()-382)/2+"px","display":"block"});
    $(".Pop .popcon").html(arguments[0]);
    if(arguments[1]&&arguments[1]!="noclose"){
        if(arguments[3]&&arguments[3]!="noclose"){
            $(".Pop .popBtn a").eq(0).attr("href",arguments[2]).html(arguments[1])
            $(".Pop .popBtn a").eq(1).attr("href",arguments[4]).html(arguments[3])
        }else{
            $(".Pop .popBtn a").eq(1).attr("href",arguments[2]).html(arguments[1])
            $(".Pop .popBtn a").eq(0).remove()
        }
    }else{
        $(".Pop .popBtn").remove()
    }
}    
function PopFnClose(){
  $(".Pop,.PopMark").remove()
}

转载于:https://www.cnblogs.com/lglijing/p/3615909.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值