zoukankan      html  css  js  c++  java
  • 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()
    }

  • 相关阅读:
    作业3月30号
    21、,模块与包的使用
    作业3月26号
    20、面向函数与匿名函数及模块
    作业3月25号
    19、迭代器及函数的递归调用
    作业3月24号
    06-函数
    3.17---购物车练习
    3.15---文件处理练习2
  • 原文地址:https://www.cnblogs.com/lglijing/p/3615909.html
Copyright © 2011-2022 走看看