我已将我的项目从 Bootstrap 4.5 更新到 Bootstrap 5。我通过简单地用npm install bootstrap@next. 现在我遇到了无法再使用引导实用程序的问题。即使它们是导入的,它们似乎也没有被编译到样式表中。
我的 app.scss 文件:
@import "variables";
@import "../node_modules/bootstrap/scss/functions";
@import "../node_modules/bootstrap/scss/variables";
@import "../node_modules/bootstrap/scss/mixins";
@import "../node_modules/bootstrap/scss/grid";
@import "../node_modules/bootstrap/scss/utilities";
Run Code Online (Sandbox Code Playgroud)
例如,如果我现在尝试使用 隐藏在元素中.d-none,那么这没有效果。编译后的样式表也不包含实用程序类。
我想要一个 div 跟随光标移动并有短暂的延迟,如下所示:http ://vanderlanth.io/
正如您所看到的,“跟随者”在动画中有短暂的延迟。
我重建了一些功能不太正常的功能:
$(document).ready(function () {
$("body").mousemove(function (e) {
handleMouseMove(e);
});
function handleMouseMove(event) {
var x = event.pageX;
var y = event.pageY;
$(".cursor-follower").animate({
left: (x - 16),
top: (y - 16)
}, 16);
$(".cursor").css({
left: (x - 4),
top: (y - 4)
});
}
});
Run Code Online (Sandbox Code Playgroud)
它相当滞后,动画也不是很流畅和轻松。您还有其他解决方案吗?