[Solved] Lets say I want my JavaScript to load all my image sources before the window loads.... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

[Solved] Lets say I want my JavaScript to load all my image sources before the window loads....

How do I do that? Secondly, how would I make items on a page unselectable? I want it to feel like a mobile app, so I don't want loading going on during view, or the cursor for text selection to appear(or be usable) EDIT https://code.sololearn.com/WI81bcO3CP4c/?ref=app updated code, now unselectable. Thanks @Maz.

19th May 2017, 6:19 PM
Russel Reeder
Russel Reeder - avatar
8 Answers
+ 7
html, body { -webkit-user-select: none; -ms-user-select: none; -khtml-user-select: none; -moz-user-select: none; -o-user-select: none; user-select: none; } This CSS code will make the elements unselectable ( credits to: @Tim G. ) For the JS code i can't help you, if i try to view your code my phone crashes. :(
19th May 2017, 6:36 PM
Maz
Maz - avatar
+ 5
Added image preloader. Seems to be working. https://code.sololearn.com/WI81bcO3CP4c/?ref=app
19th May 2017, 9:12 PM
Russel Reeder
Russel Reeder - avatar
+ 4
sorry, let me link a different code. older versions work on Pc and I hadnt made thew new one public. But nows as good a time as any https://code.sololearn.com/WI81bcO3CP4c/?ref=app Please tell me that one works
19th May 2017, 6:42 PM
Russel Reeder
Russel Reeder - avatar
+ 4
Thanks for the answer, @Maz, I'm gonna try that. Found a way to preload images, well, a couple. Gonna experiment in a bit.
19th May 2017, 6:43 PM
Russel Reeder
Russel Reeder - avatar
+ 4
this might be relevant to your image loading issue https://code.sololearn.com/WXHUApnqKBUq/?ref=app
19th May 2017, 6:43 PM
Burey
Burey - avatar
+ 4
thanks @Burey. I'll check it out
19th May 2017, 6:44 PM
Russel Reeder
Russel Reeder - avatar
+ 4
post updates :)
19th May 2017, 6:45 PM
Burey
Burey - avatar
19th May 2017, 6:52 PM
Russel Reeder
Russel Reeder - avatar