JPReddy
JPReddy

Reputation: 65513

Simplemodal doesn't reopen if I close it in the same event

I'm trying to open another simplemodal from a button click event of first simplemodal dialog.

Here is what I am trying to do. Below button belongs to the first simple modal.

  $(".someBtn").click(function () {
    $.modal.close();

    renderSomeContent();
  });


function renderSomeContent(){
 $("#popupDiv").html(markup);
 $("#popupDiv").modal();
}

Even first simplemodal is also displayed in the same div (popupDiv) which I'm using for the second modal dialog.

If I dont close the first modal in button click event it works fine but the modal position, width and height remains same as per the first modal content. This is the reason I want to close it and reopen it so that it adjusts as per the second modal content.

Can anybody tell me where I'm doing wrong?

Upvotes: 0

Views: 279

Answers (1)

JPReddy
JPReddy

Reputation: 65513

I couldn't find the solution but I found a workaround to fix the reloading resizing issue.

As I mentioned above, if I don't close the current simplemodal and update the content of that simplemodal with some other content and when I call $("#popupDiv").modal() it maintains the height and position of the first simplemodal dialog.

Once I fill the modal content I'll get the height and width of the content and update the simplemodal. Below is what I did:

$("#popupDiv").html(markup);
$.modal.update($("#popupDiv").height(), $("#popupDiv").width())

That's it I don't have to close the simplemodal and just update it with the new dimensions.

Upvotes: 0

Related Questions