jQuery Modal Dialog works fine on the first page after refresh, but not on
any other pages after that unless refreshed
Alright, so I have this jQuery modal dialog to remind non-registered users
to sign up if they try to access user-only actions. After refresh, the
dialog works fine and can be closed and opened indefinitely... On THAT
page. As soon as the page is switched the modal doesn't work unless the
page is refreshed again.
I have the modal tied to rails if else statement such as
<% if signed_in? %>
<a href="User only page">
<% else %>
<div class="modalstart">
<& end %>
HOWEVER, I tried it without the statement, and the problem persisted, so
I'm guessing this is jQuery problem.
Here's my code for the modal dialog code:
$(window).bind("load", function() {
$(document).ready(function() {
$('#modalresult').dialog({ width: 550, height: 300, autoOpen: false,
modal: true,
resizable:
false });
$( ".modalstart" ).click(function() {
$( "#modalresult" ).dialog( "open" );
return false;
});
})
});
And the div that the dialog is tied to is set not to display until called,
if it's of any consequence:
<div id="modalresult" style="display:none"></div>
The modal box has a signup form and the reqular X to close it off.
I'm thinking, could it be that jQuery somehow thinks the modal is already
in use when the user switches the page? Thanks in advance for any help or
ideas.
No comments:
Post a Comment