![](/img/trans.png)
[英]Does the value of window.scrolltop() change when toolbar/addressbar on mobile devices collapses
[英]I want to fixed scroll when the element's left change or change left reference to window.scrollTop
$(window).scroll(function() {
var elmnt = document.getElementById("layer1");
var nowLeft = elmnt.getBoundingClientRect().left;
nowLeft += nowLeft/100;
elmnt.style.left = nowLeft + "px";
console.log(nowLeft);
});
这是代码。 我想固定元素移动时用户的滚动。 并且我想在元素的左侧更改时引用window.scrollTop
。
像滚动页面一样滚动: http ://www.rleonardi.com/interactive-resume/
我想我是个小笨蛋。
elmnt.style.left = (base element's left)- window.scrollY + "px";
这样的代码。 即使滚动延迟,它也可以轻松更改左侧!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.