You need to sign in to do that
Don't have an account?
Pablo Garcia
Odd behaviour getting the window width in a Visualforce page in Salesforce1 (only iPhone)
I am writing a Visualforce page that contains some HTML <div> elements whose width depend on the device screen width. The code runs well in all browsers, except in Salesforce1 in iPhone (in iPads it's ok). I am using this js command to get the window width:
Does anybody know the cause of this odd behaviour?
Thanks!
$( window ).width();This command is call when loading the page, but different results. Sometimes is 414 and sometimes 519 (in an iPhone 6).
Does anybody know the cause of this odd behaviour?
Thanks!
Finally, I found a solution for this issue: I am using
instead of
All Answers
It's hard to tell extacly what might going on with that. Either way, if you're trying to detect the CSS media query there are better solutions to be considered and if you are only trying to detect the real viewport size of your window you should take into account all the variables.
Please refer to the links below, they might be helpful:
http://stackoverflow.com/questions/19291873/window-width-not-the-same-as-media-query
http://matanich.com/2013/01/07/viewport-size
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
Finally, I found a solution for this issue: I am using
instead of