htmlquery
htmlquery

Reputation: 1

Display Modal window using a cookie

I am trying to make a modal window display once per session using cookies. With the below code, alert box gets displayed fine once per session but if i place the modal code, it does not work.

if ($.cookie('modal') != 'shown') { 
    $.cookie('modal', 'shown'); 
    alert("message");
}

In place of alert("message") I am placing the below modal code:

$("#dialog-modal").dialog({ 
    height: 750,
    width: 1045,
    modal: true,
    resizable: false,
    draggable: false
}); 

Upvotes: 0

Views: 208

Answers (1)

Abdullah Jibaly
Abdullah Jibaly

Reputation: 54790

Did you make sure you have your jQuery code wrapped in a $(document).ready() function call, ie:

$(document).ready(function () {
    $("#dialog-modal").dialog({ 
        height: 750,
        width: 1045,
        modal: true,
        resizable: false,
        draggable: false
    });
});

Upvotes: 1

Related Questions