gpt4 book ai didi

javascript - Bootstrap 4 工具提示未按样式显示。而且它仅适用于 anchor 标记

转载 作者:行者123 更新时间:2023-12-02 23:08:47 25 4
gpt4 key购买 nike

我正在使用 bootstrap 4 并希望在我的按钮和 anchor 标记上显示工具提示。但工具提示仅显示在 anchor 标记上,而不显示在按钮上。即使工具提示确实显示,它也不会显示任何样式,这意味着它是白色的,并且看起来不像 Bootstrap 文档中那样。

这是我的代码,它是一个 ejs 模板。

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Lab Management System">
<title>Dashboard</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css">
<link href="https://use.fontawesome.com/releases/v5.9.0/css/all.css" rel="stylesheet">
<link rel="stylesheet" href="/css/sidebar.css">
<link rel="stylesheet" href="/css/card.css">
<link rel="stylesheet" href="/css/progressbar.css">


</head>

<body>
<div class="page-wrapper chiller-theme toggled">
<a id="show-sidebar" class="btn btn-sm btn-dark" href="#">
<i class="fas fa-bars"></i>
</a>
<nav class="navbar navbar-expand-lg" style="background: #31353D; color: #c5c6c7">
<button class="navbar-toggler ml-auto" type="button" style="border-color: #66fcf1;" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span style="color: azure"><i class="fas fa-bars"></i></span>
</button>

<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a href="/" class="nav-link" style="color: azure">Dashboard</a>
</li>
<li class="nav-item">
<form id="my_form" method="post" action="/logout">
<input type="hidden" name="_csrf" value="<%= csrfToken %>">
<button class="btn btn-outline my-2 my-sm-0 btnLogout" style="border-color: #66fcf1;color:#c5c6c7; background-color: transparent" type="submit">Logout</button>
</form>
</li>
</ul>
</div>
</nav>
<% include ../../include/sidebar %>


<main class="page-content">
<div class="container-fluid">

<!-- PAGE CONTENT BEGINS -->
<div class="row">
<div class="col-sm-12">
<table id="dynamic-table" class="table table-bordered table-striped table-hover" style="padding: 0px !important; margin: 0px;">
<thead class="bg-primary" style="color: white">
<tr style="LINE-HEIGHT:15px">
<th class="center">
Case ID
</th>
<th>Patient Name</th>
<th>Phone no</th>
<th>Patient ID</th>
<th>Reporting Date</th>
<th>Status</th>
<th>Action</th>
<th>Total</th>
<th>Paid</th>
<th>Due</th>
</tr>
</thead>
<tbody>

<% if(cases) {
cases.forEach(singleCase => { %>
<tr style="LINE-HEIGHT:15px">

<td class="text-center">
<%= singleCase.case_no %>
</td>
<td>
<%= singleCase.patient_name %>
</td>
<td>
<%= singleCase.patient.phone %>
</td>
<td class="text-center">
<%= singleCase.patient_id %>
</td>
<td class="text-center">
<%= singleCase.reporting_date %>
</td>
<td class="hidden-480 text-center">




<% if (singleCase.result_status == 1) { %>
<span class="badge badge-sm badge-warning">Received</span>
<% } %>
<% if (singleCase.result_status == 2) { %>
<span class="badge badge-sm badge-info">Conducted</span>
<% } %>
<% if (singleCase.result_status == 3) { %>
<span class="badge badge-sm badge-success">Approved</span>
<% } %>

</td>
<td>

<% if (singleCase.result_status == 1) { %>
<a data-toggle="tooltip" data-placement="top" id="form-field-6" href="/getcasedetails/<%= singleCase.id %>" title="Click to add results">
<span class="badge badge-sm badge-info">Add Result</span>
</a>
<% } %>
<% if (singleCase.result_status == 2) { %>
<a data-toggle="tooltip" data-placement="top" id="form-field-6" href="#" title="Click to approve results">
<span class="badge badge-sm badge-success">Approve Result</span>
</a>
<% } %>
<% if (singleCase.result_status == 3) { %>
<a data-toggle="tooltip" data-placement="top" id="form-field-6" href="#" title="Click to disapprove results">
<span class="badge badge-sm badge-danger">Disapprove</span>
</a>
<% } %>
</td>
<td class="hidden-480 text-center">
<%= Math.ceil( singleCase.total ) %>
</td>
<td class="hidden-480 text-center">
<%= Math.ceil( singleCase.paid ) %>
</td>
<td <% if(singleCase.due> 0){ %> class="text-danger text-center font-weight-bold"
<% } %>
<% if(singleCase.due == 0){ %> class="text-center text-success font-weight-bold"
<% } %>>
<%= Math.ceil( singleCase.due ) %>
</td>

</tr>
<% })
} %>
</tbody>
</table>
</div>
</div>
<!-- /.page-content -->

</div>
</main>
<!-- page-content" -->
</div>
<!-- page-wrapper -->

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
<script src="/js/jquery-ui.min.js"></script>
<script src="/js/sidebar.js"></script>


<script type="text/javascript">
$(document).ready(function() {
$('#dynamic-table').DataTable();
});
</script>

<script type="text/javascript">
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();


});
</script>
</body>

</html>

到目前为止我可以确认的是

  • poper,jquery和bootstrap js的顺序是正确的
  • 工具提示在所有元素的 jquery 文档就绪函数中初始化
  • data-toggle="tooltip" 存在于两个元素内

最佳答案

这是您正在使用的代码吗?当前代码适用于我的所有浏览器(EI、Edge、FF 和 Chrome)。您使用的是什么浏览器,是否启用了 JS?

这是基于您的示例的工作代码:jsfiddle.net/zergioz/tbgrfv4z - 将鼠标悬停在不同的状态上。

关于javascript - Bootstrap 4 工具提示未按样式显示。而且它仅适用于 anchor 标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57462621/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com