+ 8
¿¿¿Why does the Code of The Day output an error¿¿¿
a line 1 error:
14 Respuestas
+ 8
Replace that JS with mine:
https://code.sololearn.com/WVkqZ7gRLukM/?ref=app
+ 9
@Nomeh don't forget the credits to the original author (TheOtherOne), no need to give me credits.. ;)
@Dustin this is because you opened the keyboard, just close the keyboard before to run it, canvas is not resizing automatically. :/
EDIT - Noticed some downvotes, it is obviously i'm not taking credits for the other efforts and in an Open Source code i should be able to modify a code to improve it, so... if someone is offended in some way, idk... peace. Credits to @TheOtherOne only, i think his work is awesome and should be watched from everybody (also people with an old browser like mine)
In addition, i keep the code private and i added his name everywhere, so... cheers. :3
+ 8
You have to replace just the JS, i did not insert other parts of code because this is not my work, but just the JS fixed version of TheOtherOne's code
:3
+ 7
Answered by Maz in the comments of the code:
Awesome, congratulation for the COTD, your works are impressive.
My browser does not support ES6 specifications and for those who have the same problem (Uncaught SyntaxError: Unexpected Token line: 1) it is necessary delete the initializations inside the first function, for the touchmove event i recommend to add a preventDefault() inside the function (in my browser it works in this only way)
Hope to see more from you, well done! :)
+ 4
does it? worked for me?
+ 3
canvas {
width:100vw;
height:100vh;
}
Fixes the keyboard cutoff problem.
+ 2
@Maz, Well the output is
/*
Uncaught TypeError: Cannot set property 'width' of null
Line: 88.
*/
+ 2
@Maz I know that's why it's private
+ 1
The Console says /* Uncaught SyntaxError: Unexpected Token = Line: 1 */
+ 1
Excellent @Maz, It works
https://code.sololearn.com/WZmQD9sascsd/?ref=app
+ 1
@maz tried it and it works, but cuts off the whole bottom half, literally 50%of the page from the middle downward doesn't even show when moving the snake. the original code works just fine on my phone but adding your code does not work properly, no errors thrown just does not work properly. So for newer browsers your code does not work as expected
+ 1
@maz, working now. not sure why but had to close and reopen SL... great job to you and @TheOtherOne
0
@maz, your code gives me an error, line 88 "cannot set width of null ", the cotd does not...
0
makes sense, didnt think the rest of code wasn't even there. I'll try it