Page 1 of 1

Referencing an object on a particular page that has the same name across all pages

Posted: Thu Dec 10, 2015 11:57 am
by Andy Parker

Hi,

I have 2 screens in my app, both screens have common components, but laid out differently.

This works fine when these components are formatted with CSS, as I have different CSS for each component.

However, the CSS I have used doesn't work below Android 4.4, so, to get around this, I have programatically created JS to format the page if required.

So, is there any way to position objects with the same name on different screens differently with JS?

my thoughts would be somehow a derivative using:
Appery("object1 on screen1").css("top","20px");
Appery("object1 on screen2").css("top","100px");

I just need to know if there is a way of addressing the object within a page.


Referencing an object on a particular page that has the same name across all pages

Posted: Thu Dec 10, 2015 1:53 pm
by Serhii Kulibaba

Hello Andy,

Please run different JS on page show events of different pages.

on screen1:
Appery("object1").css("top","20px");

on screen2:
Appery("object1").css("top","100px");


Referencing an object on a particular page that has the same name across all pages

Posted: Thu Dec 10, 2015 2:05 pm
by Andy Parker

ah, I wish it would be that easy.

These settings are called when orientation changes, so I wanted a
"catch-all" to perform just once when we get an orientation change, rather than ever time the page is displayed.

I presume then, there is no way of addressing items a page that are not being currently displayed?


Referencing an object on a particular page that has the same name across all pages

Posted: Fri Dec 11, 2015 9:27 pm
by Serhii Kulibaba

I got it.

Please use JS code like this:

pre$("#screen1 [name=object1]").css("top","20px"); /pre


Referencing an object on a particular page that has the same name across all pages

Posted: Tue Dec 15, 2015 1:18 pm
by Andy Parker

perfect, many thanks for this!