Web页面调整大小时,Bootstrap开关无法正常工作
P粉311464935
P粉311464935 2024-04-05 08:45:39
0
1
3541

这是代码:

<nav xmlns:sec="http://www.thymeleaf.org/extras/spring-security"  class="navbar navbar-expand-lg fixed-top container-fluid" id="navbar">
<div class="container px-4">
    <a class="navbar-brand" href="/main"> <img src="https://i.imgur.com/BKHVvT0.png" style="width: 100px; height: auto;"> </a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
    <div class="collapse navbar-collapse" id="navbarResponsive">
        <ul class="navbar-nav ms-auto">
            <li  sec:authorize="isAnonymous()" class="nav-item"><a class="nav-link" href="/login">Inicio sesión</a></li>
            <li  sec:authorize="isAnonymous()" class="nav-item"><a class="nav-link" href="/register">Registro Cliente</a></li>
            <li  sec:authorize="isAnonymous()" class="nav-item"><a class="nav-link" href="/registrohotel">Registro Hotel</a></li>

            <li sec:authorize="hasAuthority('CLIENTE')" class="nav-item"><a class="nav-link" href="/historialReservaClienteVigentes">Tus reservas</a></li>
            <li sec:authorize="hasAuthority('CLIENTE')" class="nav-item"><a class="nav-link" href="/perfilcliente">Perfil</a></li>
            <li sec:authorize="hasAuthority('CLIENTE')" class="nav-item"><a sec:authorize="isAuthenticated()" class="nav-link" th:href="@{/logout}"> <i class=" fas fa-door-open"></i></a></li>

            <li sec:authorize="hasAuthority('HOTEL')" class="nav-item"><a class="nav-link" href="/admin">Administrador</a></li>
            <li sec:authorize="hasAuthority('HOTEL')" class="nav-item"><a class="nav-link" href="/perfilhotel">Perfil</a></li>
            <li sec:authorize="hasAuthority('HOTEL')" class="nav-item"><a sec:authorize="isAuthenticated()" class="nav-link" th:href="@{/logout}"> <i class="   fas fa-door-open"></i></a></li>

        </ul>
    </div>
</div>

事实是它确实出现在屏幕上,但是在交互时它什么也不做。切换器底部确实出现,但单击时,它不会使导航项出现在其上。

P粉311464935
P粉311464935

全部回复(1)
P粉463418483

如果你添加 bootstrap cdns: 脚本和 css,它就会起作用。请参阅下面的代码片段:



  
  
  
  Document
  
sssccc

[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">


  
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板