最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Bootstrap: modal.js v3.2.0 Nested modal popup - Stack Overflow

programmeradmin0浏览0评论

I am new on Bootstrap.

  • My Requirement is to open Modal Popup in a page. (Done).
  • Open Modal Popup required to open another Modal Popup. (Done).

Facing Issue :

When I goes to close the nested (Second) Modal Popup, both popup is closed at a time. Because I Use "data-dismiss='modal'" to close the modals. is there any other way to close Nested Modal Popup.

I am new on Bootstrap.

  • My Requirement is to open Modal Popup in a page. (Done).
  • Open Modal Popup required to open another Modal Popup. (Done).

Facing Issue :

When I goes to close the nested (Second) Modal Popup, both popup is closed at a time. Because I Use "data-dismiss='modal'" to close the modals. is there any other way to close Nested Modal Popup.

Share edited May 28, 2015 at 14:10 amphetamachine 30.7k12 gold badges67 silver badges74 bronze badges asked Nov 11, 2014 at 9:33 Jignesh PatelJignesh Patel 4475 silver badges16 bronze badges 1
  • Did the modals have different id's? Can you please add your nested modals code? – Jordi Castilla Commented Nov 11, 2014 at 9:37
Add a ment  | 

1 Answer 1

Reset to default 6

Ah now I understand! You'll need to close your modal using javascript then :) I've written a little function here. Just add the "closeModal" class to the button which you want to close the modal for.

Basically it finds the parent modal that the button belongs to and closes that modal. Hopefully this helps and you can change it around if needs be.

    $(".closeModal").click(function(){
        $(this).closest(".modal").modal("hide")
    });

http://jsfiddle/kjazcz5e/4/

Bootstrap provides a .modal() JQuery plugin to let you control modals. Take a look: http://getbootstrap./javascript/#modals

发布评论

评论列表(0)

  1. 暂无评论