弹出一次会话时间

时间:2015-07-24 08:03:00

标签: javascript html session popup

我的弹出窗口工作得非常好,但我需要在会话时显示弹出窗口

我已经阅读了一些文档,但我不明白如何整合这段代码......

我该怎么做?

这是代码:

HTML

   <div id="boxes">
    <div id="dialog" class="window">
       <header> <a href="#" class="js-modal-close close">×</a>
          </header>
    <a href="#" class="js-modal-close close">×</a>
        <div class="subscribeform">
            <div class="form-group">
                <asp:TextBox ID="txtname" CssClass="form-control2"   placeholder="Name" runat="server"></asp:TextBox>
            </div>
            <div class="form-group">
                <asp:TextBox ID="txtsurname" CssClass="form-control2" placeholder="Surname" runat="server"></asp:TextBox>
            </div>
            <div class="form-group">
                <asp:TextBox ID="txtemail" CssClass="form-control2" placeholder="Email"
                    runat="server"></asp:TextBox>
            </div>
            <div class="checkbox">
                <label class="uyeliksartlari">
                    <input type="checkbox">
                    Üyelik Şartlarını Kabul Ediyorum.
                </label>
            </div>
            <asp:Button ID="btngonder" runat="server" CssClass="btn btn-default" Text="Gönder"
                OnClick="btngonder_Click" />
        </div>
    </div>
    <div id="mask">
    </div>
</div>

JS

<script>
    $(document).ready(function () {

        var id = '#dialog';

        //Get the screen height and width
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();

        //Set heigth and width to mask to fill up the whole screen
        $('#mask').css({ 'width': maskWidth, 'height': maskHeight });

        //transition effect
        $('#mask').fadeIn(300);
        $('#mask').fadeTo("slow", 0.9);

        //Get the window height and width
        var winH = $(window).height();
        var winW = $(window).width();

        //Set the popup window to center
        $(id).css('top', winH / 2 - $(id).height() / 2);
        $(id).css('left', winW / 2 - $(id).width() / 2);

        //transition effect
        $(id).fadeIn(1000);

        //if close button is clicked
        $('.window .close').click(function (e) {
            //Cancel the link behavior
            e.preventDefault();

            $('#mask').hide();
            $('.window').hide();
        });

        //if mask is clicked
        $('#mask').click(function () {
            $(this).hide();
            $('.window').hide();
        });

    });

非常感谢...

0 个答案:

没有答案