我不完全理解您的问题,但是我知道一种检测用户是向上还是向下滚动的方法。
也许此片段可以帮助您。
@media(min-width: 768px){.g {font-size: 500px; position:
relative; bottom: 435px; left: 550px;font-weight: bolder;
transform:scale(2.0,1.0)}}
Fetching remote heads...
refs/
refs/heads/
fetch cdc059293a349ec0ba9dfd54f0f3d10fe19b23d8 for refs/heads/master
refs/tags/
error: Could not read 9234f9acddff368f544f7613c2bf5b795d7b3713
updating 'refs/heads/master'
from cdc059293a349ec0ba9dfd54f0f3d10fe19b23d8
to 2cefa69d3c453c913a55d7172df406c00fdce89d
sending 2 objects
done
Updating remote server info
To https://XXXX.XXXX.com/git/test.git
cdc0592..2cefa69 master -> master
error: Could not read 9234f9acddff368f544f7613c2bf5b795d7b3713
编辑
我对javascript进行了一些更改,现在应该可以为您提供帮助。
window.onscroll = function(e) {
// print "false" if direction is down and "true" if up
console.log(this.oldScroll > this.scrollY);
this.oldScroll = this.scrollY;
}
,
这是我要使用的确切代码:
const image = document.getElementById('floatingImage');
image.zoom = 1;
image.onwheel = function _image__onwheel( event ) {
event.preventDefault();
this[ e.deltaY < 0 ? 'onscrollforeward' : 'onscrollbackward' ]();
};
image.onscrollforeward = function _image__onscrollforeward( ) {
this.style.transform = `scale(${ ++this.zoom })`;
};
image.onscrollbackward = function _image__onscrollbackward( ) {
this.style.transform = `scale(${ --this.zoom })`;
};
本文链接:https://www.f2er.com/3154467.html