Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal event shown.bs.modal is not fired if a remote URL is provided #10105

Closed
iainheng opened this issue Aug 24, 2013 · 5 comments
Closed

Modal event shown.bs.modal is not fired if a remote URL is provided #10105

iainheng opened this issue Aug 24, 2013 · 5 comments
Labels
Milestone

Comments

@iainheng
Copy link

Modal event shown.bs.modal is not fired when a remote URL is provided.

I have the modal container in

<div id="variant-modal" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>

And a button

<a id="add-variant" class="btn btn-default" data-target="#variant-modal" data-toggle="modal" href="remote.php">Add a variant</a>

and the return data from the remote.php is

<div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">x</button>
                <h4 class="modal-title">Modal title</h4>
            </div>
            <div class="modal-body">some simple test</div>
            <div class="modal-footer">
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->

and I listen the shown.bs.modal as below

    $('#variant-modal').on('shown.bs.modal', function () {
        alert("shown");
    });

But the event shown.bs.modal is not fired. It is working fine when there is no remote URL though.

However, I tried event show.bs.modal and it get called everytime even though it load the content from the remote URL.

@Subtletree
Copy link

Pull request #9975 is working towards fixing this

@bogatykh
Copy link

bogatykh commented Dec 9, 2013

I can reproduce this error too. shown.bs.modal is not fired with remote url specified.

@fat
Copy link
Member

fat commented Dec 19, 2013

oh rough. i think the right fix for this is changing where the remote url loads content into… but that breaks backwards compat…

@fat
Copy link
Member

fat commented Dec 19, 2013

i could hack a fix by kinda dont want to

@glyebov
Copy link

glyebov commented May 21, 2015

Just in case somebody still need a solution. Thanx to bootstrap 3. Remove class "fade" from modal container. Seems modal() does not fire shown.bs.modal event after animation.

@twbs twbs locked and limited conversation to collaborators May 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants