我有一个名为' http://example.com/index.html'的网页。我宣布此链接调用bootstrap模式:
<a href="modal_content.html" data-toggle="modal" data-target="#myModal">My Modal</a>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content"></div>
</div>
</div>
如何拨打&#39; http://example.com/index.html&#39;打开模态&#39; #myModal&#39;来自电子邮件链接的内容 modal_content.html ?它有可能吗?
答案 0 :(得分:3)
首先,在您的id
代码中添加<a>
,以便日后点击“
<a id="clickMe" ...
然后,在电子邮件中的链接中传递GET
参数:
http://example.com/index.html?show_modal=true
让你的JS检查它:
if (location.search.indexOf('show_modal=true') > 0)
$('#clickMe').click();