Bootstrap模式在云中不起作用

时间:2017-08-22 23:17:42

标签: jquery asp.net twitter-bootstrap azure azure-web-sites

我在我的项目中实现了bootstrap模式,用ASP.NET编写了MVC。我为几个字段实现了bootstrap模式。当我在localhost上运行项目时,模态运行良好。但是,在azure上托管的版本弹出时,模态不会立即加载/关闭。 不知道我在这里错过了什么。有什么建议吗?

提前致谢。

1 个答案:

答案 0 :(得分:0)

请检查所有必需的CSS,JS文件是否可用以及浏览器控制台工具中是否出现任何错误。如果可能,请分享您的代码,以帮助重现问题。

此外,我在我的网络应用程序中使用Bootstrap Modal Plugin,在本地和Azure上都可以正常工作,你可以参考示例代码。

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
    <div class="container">
        <h2>Modal Example</h2>
        <!-- Trigger the modal with a button -->
        <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
        <button type="button" class="btn btn-info btn-lg" onclick="openmodal()">Open Modal Via JavaScript</button>

        <!-- Modal -->
        <div class="modal fade" id="myModal" role="dialog">
            <div class="modal-dialog">

                <!-- Modal content-->
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h4 class="modal-title">Modal Header</h4>
                    </div>
                    <div class="modal-body">
                        <p>Some text in the modal.</p>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    </div>
                </div>

            </div>
        </div>
    </div>
</body>
</html>
<script>
    function openmodal() {
        $("#myModal").modal("show");
    }
</script>

enter image description here

正如我在上面的代码中所做的那样,您可以尝试通过JavaScript手动触发模态,并检查它是否在您的网络应用程序上正常工作。