It is not public yet but I published it in Appery. Is that good enough for what you need?
It is not public yet but I published it in Appery. Is that good enough for what you need?
The grouped buttons I want to center are on the home page.
Hi Jay,
Your button group is named "mobilegroupedbuttons_55" and in code you use "mobilegroupedbuttons".
I originally used that name but it wasn't working. Now it does, however, I don't want the width of the buttons to get smaller. I tried taking your reference to left margin out of the code but now the button size remains small and it is left aligned. See image and code...
Code:
bg = Appery("mobilegroupedbuttons_55");
bg.css("position", "absolute");
bg.css("top", "50%");
bg.css("margin-top", -parseInt(bg.css("height"))/2);
Jay,
If you need to align vertically only and leave the screen width, add the following code to the existing:prebg.css("width", "100%");/pre
Hi Jay,
Please also add the following:precodebg.css("left", "0");
bg.css("margin-left", "0");/code/pre
The solution you gave some time ago to centre buttons was working fine both during test and on the phone, for some reason it has now stopped working properly on either, the button group is pushed too far to the right. The code you gave is :-
bg = Appery("mobilegroupedbuttons");
bg.css("position", "absolute");
bg.css("top", "50%");
bg.css("left", "50%");
bg.css("margin-left", -parseInt(bg.css("width"))/2);
bg.css("margin-top", -parseInt(bg.css("height"))/2);
Why would it have changed? There are no errors.
I have discovered what was wrong. Originally I was using static values for the button text but have now moved on to dynamic values coming from a service via local storage. I was setting the button value from the 'page show' event, if you set the values from 'page load' instead it works OK. Presumably the values were being calculated from the dimensions before the content was changed in 'page show'.
Hi Kevin,
Thank you for the update! Do you need any further help?