I have a div on a landing page, and i want it to scrol down the page when i am scrolling.
i try this:
var sub =document.getElementById("minisite_send_button");
window.onscroll = function (event) {
sub.style.position=fixed;
sub.style.top=200px;
}
but i get this error :
SyntaxError: identifier starts immediately after numeric literal
sub.style.top=200px;
Why am i getting this? And how can i solve this ?
Thanks :)
fixed
and 200px
is treated as a variables name. You have to put it in quotes.
Just try with:
sub.style.position = 'fixed';
sub.style.top = '200px';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.