0

I have a button that triggers a modal window to show up. Because of data-toggle="modal" the url is not changed to www.doman.com/index.html#modalDiv, and I need it to change.

Is there an elegant way to achieve this?

Only thing that comes to my mind is to have a script that will add the hash to the url, but I was wondering if there is simpler solution.

4

1 回答 1

0

看起来您将不得不覆盖数据模式的默认处理,因为它在 Bootstrap 中的代码包含一个return false.

您将必须创建自己的解决方法。就像是:

删除data-toggle="modal"并添加一个类launch-modal<a>元素

然后是一些javascript:

$('a.launch-modal').click(function (e) {
    var modalId = $(this).attr('href');
    $(modalId).show();
});
于 2014-02-26T16:02:55.720 回答