Thursday, 17 September 2015

HTML TABLE POPUP BOX

How to Generate Jquery Popup Box


JS CODE:-

<script>
    $(function () {
        var $clone = $('.demo_table').clone();
        var tab = $clone.html();
        $(".demo_tabledemo").append(tab);
        var overlay = $('<div id="overlay"></div>');
        $('.close').click(function () {
            $('.popup').hide();
            overlay.appendTo(document.body).remove();
            return false;
        });

        $('.x').click(function () {
            $('.popup').hide();
            overlay.appendTo(document.body).remove();
            return false;
        });
        overlay.show();
        overlay.appendTo(document.body);
        $('.popup').show();

    });
</script>

CSS :- 

<style>
    #overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: #000;
        filter:alpha(opacity=70);
        -moz-opacity:0.7;
        -khtml-opacity: 0.7;
        opacity: 0.7;
        z-index: 100;
        display: none;
    }
    .content a{
        text-decoration: none;
    }
    .popup{
        width: 100%;
        margin: 0 auto;
        display: none;
        position: fixed;
        z-index: 101;
    }
    .content{
        min-width: 600px;
        width: 600px;
        min-height: 150px;
        margin: 100px auto;
        background: #f3f3f3;
        position: relative;
        z-index: 103;
        padding: 10px;
        border-radius: 5px;
        box-shadow: 0 2px 5px #000;
    }
    .content p{
        clear: both;
        color: #555555;
        text-align: justify;
    }
    .content p a{
        color: #d91900;
        font-weight: bold;
    }
    .content .x{
        float: right;
        height: 35px;
        left: 22px;
        position: relative;
        top: -25px;
        width: 34px;
    }
    .content .x:hover{
        cursor: pointer;
    }
</style> 

HTML :-

<div class='popup'>
<div class='content'>
<img src='close.png' alt='quit' class='x' id='x' />
<div class="demo_tabledemo">
 </div> 
<br/>
<br/>
<a href='' class='close'>Close</a></div>
</div>        
<div class="demo_table">
    <table class="table">
        <thead>
            <tr>
                <th>Row</th>
                <th>Bill</th>
                <th>Payment Date</th>
                <th>Payment Status</th>
            </tr>
        </thead>
        <tbody>
            <tr class="active">
                <td>1</td>
                <td>Credit Card</td>
                <td>04/07/2014</td>
                <td>Call to confirm</td>
            </tr>
            <tr class="success">
                <td>2</td>
                <td>Water</td>
                <td>01/07/2014</td>
                <td>Paid</td>
            </tr>
            <tr class="info">
                <td>3</td>
                <td>Internet</td>
                <td>05/07/2014</td>
                <td>Change plan</td>
            </tr>
            <tr class="warning">
                <td>4</td>
                <td>Electricity</td>
                <td>03/07/2014</td>
                <td>Pending</td>
            </tr>
            <tr class="danger">
                <td>5</td>
                <td>Telephone</td>
                <td>06/07/2014</td>
                <td>Due</td>
            </tr>
             <tr class="danger">
                <td>6</td>
                <td>Mug</td>
                <td>06/07/2014</td>
                <td>PAID</td>
            </tr>
        </tbody>
    </table>
</div>

IMAGE :- 


Download