【发布时间】:2018-07-08 05:34:26
【问题描述】:
我的网站上有一个可折叠的导航栏。它会自动关闭,并且没有理论上实现的平滑效果。这是一个Bootstrap 4 Jekyll 网站,使用 gulpfile 构建,该文件可以连接、缩小和丑化 HTML、css 和 Javascript:http://reporteca.umh.es/
除了可折叠的导航栏外,一切都运行良好。可折叠导航栏在我的计算机本地加载时实际上有效,但在发布时无效。
我猜这个问题可能是由 HTML/css 缩小过程引起的。
这是它在 DOM 中的样子:
<div class="bg-dark collapse" id="navbarHeader" style="">
<div class="container">
<div class="row">
<div class="col-sm-8 col-md-7 py-4">
<h4 class="text-white">Acerca de</h4>
<p class="text-muted">Add some information about the album below, the author, or any other background context. Make it a few sentences long so folks can pick up some informative tidbits. Then, link them off to some social networking sites or contact information.</p>
</div>
<div class="col-sm-4 offset-md-1 py-4">
<h4 class="text-white">Contacto</h4>
<ul class="list-unstyled">
<li><a href="#" class="text-white">Twitter</a></li>
<li><a href="#" class="text-white">Facebook</a></li>
<li><a href="#" class="text-white">Email</a></li>
</ul>
</div>
</div>
</div>
</div>
请记住:相同的代码在本地工作,但在发布时不能。
Javascript 文件与 Bootstrap 4 中的完全相同:
<script src="/js/jquery-slim.min.js"></script>
<script src="/js/popper.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
有什么帮助吗?
【问题讨论】:
-
你能发布代码来重现问题,而不是链接到外部网站吗?
-
谢谢。我正在编辑帖子。
-
您能否将答案添加为单独的答案并将其标记为已接受,而不是将其编辑到问题中?
-
解决了。该问题是在 Gulp-Uncss 过程中引起的。我只是添加了这个异常以避免发布时的错误:
pipe(uncss({ html: ['_site/**/*.html'], ignore: ['.fade', '.collapse', '.collapse.show', '.collapsing'] }))More information
标签: javascript jquery bootstrap-4 minify collapse