在bootstrap 3上没有调用Modal

Modal not being called on bootstrap 3

本文关键字:调用 Modal bootstrap      更新时间:2023-09-26

我有以下代码:

<div class="btn slick-slide slick-active" data-toggle="modal" data-target="#photo-carousel-modal" data-slick-index="0" aria-hidden="false" style="width: 234px;">
    <img class="img-holder img-thumbnail" src="image/path.jpg">
</div>

应该调用这里的模态:

 <div class="modal fade bs-example-modal-lg" id="photo-carousel-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            {{-- Modal's content --}}
        </div>
    </div>
</div>

它根本不会触发任何东西!我是不是做了什么蠢事却没有意识到?

注:: 是的!Bootstrap工作正常。我在代码的其他部分使用它,它像一个魅力!

确保你的bootstrap.js文件名为你的jQuery文件之后,像这样:

<script src="path/to/jquery-file.js"></script>
<script src="path/to/bootstrap.js"></script>

(另外,删除任何其他bootstrap js文件,如bootstrap-modal.js等,因为bootstrap.js已经包含了所有内容)

如果以上已经完成,但仍然没有显示,请将您的<head....</head和您的网页页脚的代码贴在您的问题上。

注:检查你的浏览器控制台是否有错误,这样你就可以更好地了解发生了什么。

我后来发现我的代码有3个调用jQuery库。其中一个是在引导调用之后。这就是我搞砸的地方!

(事实上,是另一个人在这里工作。)

所以,孩子们:不要把你的JQUERY调用放在BOOTSTRAP调用之后!它会让你发疯的!