我正在使用 twitter 的引导程序创建一个 Web 应用程序。该应用程序包含一个页面,该页面在 iframe 中加载同一域的另一个页面。现在我的问题是,如果我在 iframe 中加载的页面也包含 bootstrap.js 文件,它开始与应用程序冲突。例如,我的应用程序有一个使用数据属性构建的手风琴(折叠) http://twitter.github.com/bootstrap/javascript.html#collapse 。加载带有 bootstrap.js 的页面后,折叠事件开始被触发两次。所以类似于
<head>//Bootstrap css and js files included</head>
<body>
   <div>
     //Collapsible Menu #1
   </div>
   <iframe>
       <head>
           //BootStrap.js script from same location as parent
       </head>
       <body>
           // Another Collapsible Menu #2
       </body>
    `  </head> 
   </iframe>
</body>
在这里,当我尝试单击菜单 #1 时,Bootstrap.js 的代码被触发两次,最终显示然后隐藏菜单。但我的问题不仅限于菜单。我需要能够在我的应用程序中使用 bootstrap.js,并且还允许在 iframe 中加载已经包含 bootstrap.js 的页面。
有没有办法解决这个问题或者我做错了什么?