[SOLVED] Detecting device screen orientation and screen size problem
Hi SoloLearners ... In attempt to answer a query https://www.sololearn.com/Discuss/2979391/?ref=app I am trying to write a code (editing OP's code) https://code.sololearn.com/WIHCWRjQCfqQ/?ref=app It should display the screen size (width and height) on the page, and it should do that when the screen orientation changes or when window resizes. But it is displaying nonsensically incorrect values, and doesn't seem to be doing its work consistently. Please point me to the mistake and suggest me a workaround. Thank you in advance 🙏 (Edit) Updated code https://code.sololearn.com/WRTsbf87IS4u/?ref=app
To all of you ❤ for helping a fellow programmer in solving an issue. Without the majority of helpers engaged and without you all actually noticing, that you all have done something unique and in the meantime learned a thing or two yourself. Kudos for all of you for helping someone else to solve a problem. This proves again that TOGETHER WE ARE STANDING STRONG this is also the notice written on the Armourshield of Belgium 🇧🇪 the country I was born. Remember that you are the future and show us the way to a peaceful and long-term relationship in a world of peace ✌ 🙏 I am old and retired but keep my self busy good luck to your all and lots of kudos 👏
Solomoni Railoa, Thanks for the update. I will study the code and learn.
Solomoni Railoa, I think you can also help her out. After all, I finally learned that I should've only used the "onorientationchange" event to get notified of orientation change, and use "onresize" event to deal with screen size changes instead. Thanks one more time 🙏
Jay Matthews sir, Thanks but I need help with the JS part in particular.
Solomoni Railoa, Thanks for the code. Am I doing something wrong by mapping "onorientationchange"? I see your code works even just mapping "onresize" event. Please tell me what I'm doing wrong ...
Runtime Terror, Thanks for the idea, I kinda get how width & height can be used to predict orientation. But can you please look into my code and tell me why it's not doing its work correctly?