2
function LoadModal(page, title) {
    title = title || '';

    $( "#modal_page" ).fadeIn("slow");
    $( "#modal_title" ).html(title);

    $("#modal_page_body").html('<h2 align="center">Loading...</h3><p align="center"><i class="fa fa-refresh fa-spin fa-5x"></i></p>'); //$('#LoadingDiv').show();
    $("#modal_page_body").load(page, function(){

    });
    $("html, body").animate({ scrollTop: 0 }, "slow");
}

i have the above function in JQuery and i call it with this code:

<a href="#" onClick="LoadModal('/section/helpdesk/newticket', 'New Ticket');" title="New Ticket"><i class="fa fa-ticket"></i></a>

Its working how i want it and the page is loading into the modal which is displaying fine.

However, when I close the Modal $("#modal_page").fadeOut("slow") any JQuery code on the main index.php page is not running. For example, I have a .toggle but that does not work. If i refresh the page, it then works fine until i open and close this modal again

3
  • I guess you have called jQuery lib file in your pop up page. So it's replacing the whole jQuery. Then after its gone jQuery has nothing. So, try removing jQuery from there. If not fixed then some code from that page will be helpful for us. Commented Dec 16, 2015 at 23:33
  • perfect - stick that as an answer and ill accept it :) Commented Dec 16, 2015 at 23:44
  • I think what you need to do is have the content in the modal refreshed while it's hidden. I have had a similar problem and this seemed to fix it stackoverflow.com/questions/26863003/… Commented Dec 16, 2015 at 23:57

1 Answer 1

1

I think you have called jQuery lib file in your pop up page. So it's replacing the whole jQuery. Then after its gone jQuery has nothing. So, try removing jQuery from there.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.