springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-18 12:08:07
48
我所得到的只是计算一个元素的宽度,并找出它在屏幕上所占的百分比,但过渡并不平滑。CodeSandBox链接:https://codesandbox.io/s/fragrant-fire-ejxvd?file=/index.html.
const container = document.querySelector(".container");
const arrayOfElements = [];
let currentPercent = 0;
let percentOfElement = 0;
function createSlideElement() {
const element = document.createElement("span");
element.className = "slider-element";
element.innerText = "|my ugly slide|";
element.style.right = `${currentPercent}%`;
container.append(element);
arrayOfElements.push(element);
const elementWidth = element.getBoundingClientRect().width;
percentOfElement = (elementWidth / window.innerWidth) * 100;
}
function step() {
currentPercent += 0.1;
for (let el of arrayOfElements) {
el.style.right = `${currentPercent}%`;
}
if (currentPercent >= percentOfElement) {
currentPercent = 0;
}
window.requestAnimationFrame(step);
}
createSlideElement();
createSlideElement();
createSlideElement();
window.requestAnimationFrame(step);
顺晟科技:
不使用window.innerWidth
,而是使用container.getBoundingClientRect().width
来计算percentOfElement
工作代码沙箱:-
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11