我做了视差效果here灵感来自this website。目前它监听mousemove事件并使用CSS转换来执行视差。我也使用lodash的油门功能,所以事件不会经常发生。 伪代码: let parallax = (e) => {
// calculate deltas of mouse x and y from the midpoint
// multiplier = 0.01
我为中心的对象用下面的代码: .object {
width: 70%;
height: 70%;
position: absolute;
top: 50%;
left:50%;
/* these are the lines to which I will refer */
margin-top: -350px;
m