Scrolling past loading screen
I've implemented a loading screen while all the gifs in my website is loading but I've found that even while it is loading I am able to scroll past it since it is just covering one section.
Is there anything I can do to disable scrolling while it is loading?
8 Replies
You can probably do this by adding preventDefault to your window "scroll" event listener.
However, how have you added the loaded screen? If you use position "fixed" it will remain in place over the contents even if the user scrolls.
Thanks Chris, I will try to implement that and see how it goes.
I'm still not sure where I'm going wrong here. I've tried position: fixed; but I am still able to scroll. Would you mind taking a look?
I can now see from your code that you are scrolling horizontally.
You need to define the left position of the loading element too. ie
left: 0;
I apologise for the sphagetti code.
But I defined left position like you suggested and it still dosen't seem to work.
sorry, you are right. I did have this working on a temporary fork that I created from your code but then I went and deleted it by mistake. let me see if I can get it working again....
You're a legend, Chris
hold on. I might not be able to work it out....
Try moving your loading element outside of the "main" tag - ie make it a direct child of the body.
Told you, you're a legend
I'll drop you a follow on twitter ❤️