Jquery scrollspy,工具提示在express应用程序中不起作用
我第一次开发我的express应用程序,很多奇怪的事情发生在我身上。我试图使用scrollspy和工具提示引导功能,但由于某些原因,它们不起作用。我收到两条错误消息:Jquery scrollspy,工具提示在express应用程序中不起作用,jquery,bootstrap-4,scrollspy,Jquery,Bootstrap 4,Scrollspy,我第一次开发我的express应用程序,很多奇怪的事情发生在我身上。我试图使用scrollspy和工具提示引导功能,但由于某些原因,它们不起作用。我收到两条错误消息: jquery.js:3841 jQuery.Deferred exception: $(...).scrollspy is not a function TypeError: $(...).scrollspy is not a function 及 工具提示也是如此 我想在这里向您展示我的设置,以便您发表评论 我用的是车把,在我
jquery.js:3841 jQuery.Deferred exception: $(...).scrollspy is not a function TypeError: $(...).scrollspy is not a function
及
工具提示也是如此
我想在这里向您展示我的设置,以便您发表评论
我用的是车把,在我的主驾驶室里,我有这个
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{{title}}</title>
<link rel="stylesheet" href="/css/main.css">
</head>
<body>
{{> _msg}}
{{{body}}}
<script src="/dist/vendor.bundle.js" charset="utf-8"></script>
<script src="/dist/main.bundle.js" charset="utf-8"></script>
</body>
</html>
在我的src/scripts/vendor.js中,我只有这个
import "bootstrap"
在我的src/scripts/script.js中,我有我想在页面中使用的所有jquery和js
require('../scss/style.scss')
let helper = require('./functions')
const $ = require('jquery')
$(document).ready(function(){
$('body').scrollspy({ target: '#sideMenu'})
$('[data-toggle="tooltip"]').tooltip(
{
placement:"bottom",
delay: {show: 100, hide: 100},
boundary: 'window'
}
);
});
然后我有一个名为details.hbs的页面,其中我有id=sideMenu的div,但当我转到这个页面时,scrollspy不工作,我得到了我前面描述的错误
同样适用于页面results.hbs,我想在其中显示一些鼠标悬停在图标上的工具提示
<img src="/images/detail.svg" title="some title." class="tooltipImg mr-2" data-toggle="tooltip">
实际上我只是缺少bootstrap.bundle.min.js。我很困惑,因为我有
在src/scripts/vendor.js文件中导入“bootstrap”
,我想这也会导入bundle.js
require('../scss/style.scss')
let helper = require('./functions')
const $ = require('jquery')
$(document).ready(function(){
$('body').scrollspy({ target: '#sideMenu'})
$('[data-toggle="tooltip"]').tooltip(
{
placement:"bottom",
delay: {show: 100, hide: 100},
boundary: 'window'
}
);
});
<img src="/images/detail.svg" title="some title." class="tooltipImg mr-2" data-toggle="tooltip">