Page 1 of 1

Javascript Panel Height & Width

Posted: Sun Jun 09, 2013 5:35 pm
by Jimmy

I tried the javascript code below and pw = 0 when in appery's property screen it' set to 250. What is wrong? Thanks.

var panel = Appery("panel_2");

var ph = panel.height();

var pw = panel.width();

alert(pw);


Javascript Panel Height & Width

Posted: Sun Jun 09, 2013 5:52 pm
by Igor

Hello,

You code should work. How did you invoke this code? Please ensure that Panel element name is "panel_2".


Javascript Panel Height & Width

Posted: Sun Jun 09, 2013 6:02 pm
by Jimmy

panel element name is panel_2, it doesn't work. You can see for yourself. I have included the screenshots. Thanks.

Image Image


Javascript Panel Height & Width

Posted: Sun Jun 09, 2013 6:16 pm
by Igor

You should try to add this code on some button click action. It's not working because alert action triggering before creating panel element.


Javascript Panel Height & Width

Posted: Sun Jun 09, 2013 10:17 pm
by Jimmy

Thanks, your suggestion worked. How do i get the default page resolution 320x480 instead of the panel_2 dimensions?


Javascript Panel Height & Width

Posted: Sun Jun 09, 2013 10:58 pm
by Illya Stepanov

Project - App Settings - Default Page Size


Javascript Panel Height & Width

Posted: Mon Jun 10, 2013 3:05 pm
by Jimmy

I know that you can manually go to the settings to get the page size. I meant how do i get the page size through javascript? Thanks.


Javascript Panel Height & Width

Posted: Mon Jun 10, 2013 3:52 pm
by Maryna Brodina

Hello! Try code$(window).width()/code and code$(window).height()/code