莫代尔没有在heroku上工作;但在本地运行良好

modal not working on heroku; but works fine locally

本文关键字:运行 heroku 工作      更新时间:2023-09-26

简单的引导模式由一个按钮触发,一旦按钮被推到heroku,当按钮被点击时,该模式将不再显示。我似乎不明白为什么,我已经尝试了所有我能在网上找到的解决方案,但都没有奏效。我使用的是引导网站上的模式/按钮组合,删除了我的自定义功能,直到我确信它能在Heroku上运行。下面的HTML。这是我的heroku应用程序的链接-http://themommyboxco.herokuapp.com/

<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal 
</button>
<!-- Modal -->
<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 class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        This modal is not showing up on heroku!
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>

您的应用程序.js中有一个语法错误,第13371行

$(function() 
  $("#menu").click(function() {

应为:

$(function() {
  $("#menu").click(function() {

确保结束标记稍后也在那里。