javascript onclick create(element) div viz popup box

前端 未结 4 1131
天涯浪人
天涯浪人 2021-01-15 01:51

I\'m trying to make a pop up box, which gets invoked on clicking a button, this is what I\'ve got so far.. http://jsfiddle.net/WGPhG/2/

4条回答
  •  生来不讨喜
    2021-01-15 02:03

    Try this update on JSFiddle

    Changed :

    1. Center page (fixed).
    2. effect (fadein and fadeout)

    HTML

    
    
    

    CSS

    .popup {
        position:fixed;
        top:0px;
        left:0px;
        bottom:0px;
        right:0px;  
        margin:auto;
        width:200px;
        height:150px;
        font-family:verdana;
        font-size:13px;
        padding:10px;
        background-color:rgb(240,240,240);
        border:2px solid grey;
        z-index:100000000000000000;
    }
    
    .cancel {
        display:relative;
        cursor:pointer;
        margin:0;
        float:right;
        height:10px;
        width:14px;
        padding:0 0 5px 0;
        background-color:red;
        text-align:center;
        font-weight:bold;
        font-size:11px;
        color:white;
        border-radius:3px;
        z-index:100000000000000000;
    }
    
    .cancel:hover {
        background:rgb(255,50,50);
    }
    

    JS

    function openPopup() {
        //document.getElementById('test').style.display = 'block';
       $('#test').fadeIn(1000);
    }
    
    function closePopup() {
        //document.getElementById('test').style.display = 'none';
        $('#test').fadeOut(500);
    }
    

提交回复
热议问题