javascript - 基于 URL 中的 HASH 打开 Bootstrap 模式

标签 javascript jquery twitter-bootstrap

如果 URL 包含带有 id 参数的 HASH,如何在页面加载后打开 delete Bootstrap 模式?

示例:

http://example.com/properties#delete-86

最佳答案

您可以在脚本开头执行以下操作:

// You can retrieve the id in 'matches' variable if needed
if (matches = window.location.href.match(/#delete-([0-9])+/))
{
    $('#my-modal').modal('show');
}

关于javascript - 基于 URL 中的 HASH 打开 Bootstrap 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36917775/

相关文章:

php - 将参数传递给 jquery javascript 函数?

javascript - jqueryUI 可选择与 AngularJS 不适合我

javascript - 检查 jQuery 是否被内容过滤器阻止

javascript - Bootstrap Accordion ,单击时滚动到事件(打开) Accordion 的顶部?

javascript - 在 div 标签中包装 .addEventListener

javascript - 如何让这个 CSS/jQuery 菜单只在点击时打开,而不是悬停时打开?

html - 内部带有翻转效果的 Bootstrap 轮播

jquery - MVC 5 与来自部分 View 验证的 Bootstrap Modal 不起作用?

javascript - Angular:在 HTML/模板中使用另一个模块的功能

javascript - 将一个数组映射到具有负索引偏移量的第二个数组