Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

The font-size does not scale for checkbox, selectMenu, NavBar

Hello,

On my login page, I used the following js on page load event:
code
var height100 = jQuery("body").height();
if(height100 < 350)
{
Apperyio("mobilelabel_4")&#46;css("font-size", "8px");
Apperyio("mobiletextinput_5")&#46;css("font-size", "8px");
Apperyio("mobiletextinput_7")&#46;css("font-size", "8px");
Apperyio("mobilelabel_6")&#46;css("font-size", "8px");
Apperyio("mobilelabel_8")&#46;css("font-size", "8px");
Apperyio("sm1_1_Language")&#46;css("font-size", "8px");
Apperyio("mobilecheckbox_12")&#46;css("font-size", "8px");
Apperyio("mobilebutton_15")&#46;css("font-size", "8px");
Apperyio("mobilebutton_16")&#46;css("font-size", "8px");
}
else if (height100 > 350 && height100 < 750)
{
Apperyio("mobilelabel_4")&#46;css("font-size", "14px");
Apperyio("mobiletextinput_5")&#46;css("font-size", "14px");
Apperyio("mobiletextinput_7")&#46;css("font-size", "14px");
Apperyio("mobilelabel_6")&#46;css("font-size", "14px");
Apperyio("mobilelabel_8")&#46;css("font-size", "14px");
Apperyio("sm1_1_Language")&#46;css("font-size", "14px");
Apperyio("mobilecheckbox_12")&#46;css("font-size", "14px");
Apperyio("mobilebutton_15")&#46;css("font-size", "14px");
Apperyio("mobilebutton_16")&#46;css("font-size", "14px");
}
else
{
Apperyio("mobilelabel_4")&#46;css("font-size", "18px");
Apperyio("mobiletextinput_5")&#46;css("font-size", "18px");
Apperyio("mobiletextinput_7")&#46;css("font-size", "18px");
Apperyio("mobilelabel_6")&#46;css("font-size", "18px");
Apperyio("mobilelabel_8")&#46;css("font-size", "18px");
Apperyio("sm1_1_Language")&#46;css("font-size", "18px");
Apperyio("mobilecheckbox_12")&#46;css("font-size", "18px");
Apperyio("mobilebutton_15")&#46;css("font-size", "18px");
Apperyio("mobilebutton_16")&#46;css("font-size", "18px");
}
/code

Which bascially changes the size of font based on the screen height. All items font size has scalled very well except three as follow:

1) Checkbox: mobilecheckbox_12 (login page)
2) selectMenu: sm1_1_Language (login page)
3) NavBar: Apperyio("MasterNavBar_80").css("font-size", "10x"); (home page)

Do these items need different method to handle the font size? how?

In order to reproduce the problem:
Public link:
http://appery.io/app/mobile-frame?src...

The first two items in the first page/login page (pg100_loginPage)
The NavBar in pg200_homePage
login cerdentials: haytham/star1234

Snapshots:
login page:
Image

home page:
Image

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

The font-size does not scale for checkbox, selectMenu, NavBar

Hi Hawk,

Here is right code for these elements:

pre

&#47;&#47;For cheeckbox component with "mobilecheckbox_7" name&#46;
Apperyio("mobilecheckbox_7")&#46;closest('[data-role="fieldcontain"]')&#46;find("label")&#46;css("font-size", "34px");

&#47;&#47;For select component with "mobileselectmenu_10" name&#46;
Apperyio("mobileselectmenu_10")&#46;closest('[data-role="fieldcontain"]')&#46;find("span")&#46;css("font-size", "34px");

&#47;&#47;For navbar component with "mobilenavbar_12" name&#46;
Apperyio("mobilenavbar_12")&#46;find("&#46;ui-btn")&#46;css("font-size", "34px");

/pre

Regards.

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

The font-size does not scale for checkbox, selectMenu, NavBar

Thank you. It works. But there is few issues
1) The checkBox, how to change the tick box size along with the font size. It seems the text goes behind this tick box when it is small. I tried this but it does not work:

code
Apperyio("ui-checkbox")&#46;css("width", "20px");
Apperyio("ui-checkbox")&#46;css("height", "20px");
/code

2) The other thing is how to change the font of the pop-up list that appears from selectMenu

3) NavBar, the text goes hind the icons when it's small

Image

Image

Image

Image

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

The font-size does not scale for checkbox, selectMenu, NavBar

Hi Hawk,

Cant understand your question.

That's what i have after change font-size.. http://prntscr.com/4l09yk/direct

So you need to provide us more information about how to reproduce the problem(may be you can give us public link where we can see it).

Regards.

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

The font-size does not scale for checkbox, selectMenu, NavBar

Hi Yurri,

In order to reproduce the problem:
Public link:
http://appery.io/app/mobile-frame?src...

In testing, you'll have to change the screen dimensions to the samllest size and press refresh, you'll find items size is smaller but there is problems with the following items:

The first two items (checkBox) in the first page/login page (pg100_loginPage)
The NavBar in pg200_homePage
login cerdentials: haytham/star1234

Basically, after I followed your advice I faced three issues as follows:

1) The checkBox in first page/login page, does not scale along with the text size. First snapshot shows that with smaller font size the tickBox has the same size. The text should be "Remember me", but part of it is hidden behind the tick box and only shows "emember Me" with "R". So how to scale the tick box size based on the body height? I treid the following but it did not work.change the tick box size along with the font size. It seems the text goes behind this tic

Apperyio("ui-checkbox").css("width", "20px");
Apperyio("ui-checkbox").css("height", "20px");

Image

-----------------------------------------------------------

2) The other thing is how to change the font of the pop-up list that appears from selectMenu, the following snapshots show that the select menu button has small size but when I click on it to show the select list, the items still have the original big size

Image

Image

-----------------------------------------------------------------------------

3) NavBar, (which is in the next page). The text goes behind the icons when it's small. Here I do not want to make the icon smaller. I just want to maintain the text position to be below the icons and not behind them:

When it's big font size:
Image

When it's small font size;
Image

These three issues I'm facing all about the same question, how to resize these componenets properly (checkBox, selectMenu, NavBar).

Many thanks in advance for your help

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

The font-size does not scale for checkbox, selectMenu, NavBar

Hi Hawk,

Please use following style to set some left margin for text in checkbox.

pre

padding-left: 28px;

/pre

Regards.

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

The font-size does not scale for checkbox, selectMenu, NavBar

Hi Yurri, that worked in terms of showing the text for both checkBox and NavBar, but still cannot find a way to resize the tickBox using JS script. I tried this on load page event:

Apperyio("ui-checkbox").css("width", "20px");
Apperyio("ui-checkbox").css("height", "20px");

I am using JS as I need to resize the tickbox based on the body height (screen dimension).

2) SelectMenu items font-size does not scale with rest of items. I used this to resize the font of the selectMenu Button:

code
if(height100 < 350)
{
Apperyio("sm1_1_Language")&#46;css("font-size", "8px");
}
else if (height100 > 350 && height100 < 750)
{
Apperyio("sm1_1_Language")&#46;css("font-size", "14px");
}
else
{
Apperyio("sm1_1_Language")&#46;css("font-size", "20px");
};
/code

But that did not change the font-size of the list pops up when I open selectMenu

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

The font-size does not scale for checkbox, selectMenu, NavBar

Hi Hawk,

At first i need to say(at this time) you have increase your requirements to fit styles in accordance to page dimensions. In this time i can suggest you to see other(more preferable) way to do it. Please take a look here how it works: https://developer.mozilla.org/en-US/d...

  1. To set checkbox background image you need:
    1.1 Create JS asset and populate it with following code: http://prntscr.com/4lck88/direct

    pre

    &#47;&#47;This function will be used to add some css rule to the page&#46;
    function addCSSRule(sheet, selector, rules, index) {
    if("insertRule" in sheet) {
    sheet&#46;insertRule(selector + "{" + rules + "}", index);
    }
    else if("addRule" in sheet) {
    sheet&#46;addRule(selector, rules, index);
    }
    }

    /pre

    1.2 Use following code to set background image for checkbox:

    pre

    &#47;&#47;Here you can set width and heigh styles you need&#46;
    addCSSRule(document&#46;styleSheets[0], 'html body &#46;ui-checkbox &#46;ui-btn:after', "height: 10px; width: 10px; background-size: cover;");

    /pre

  2. To set font-size for select menu list you can use following code:

    pre

    addCSSRule(document&#46;styleSheets[0], 'html body &#46;ui-selectmenu-list &#46;ui-btn', "font-size: 40px;");

    /pre

    Note: when you use "addCSSRule" function - you add CSS rule - it means you add it one time and all items(specified in rule) will have this style after. So you don't need to use this code for all component on the page.

    Regards.

Jack Bua
Posts: 0
Joined: Sun Jun 28, 2015 10:16 pm

The font-size does not scale for checkbox, selectMenu, NavBar

Thank you Yurii for this code. It helped me in regard to my items in my select menu list being too big to show on one line. Note to anyone wanting to use this: make sure you add the function he also posts in order to get the code to work. And check your console for errors (F12 in test mode). It would have save me lots of time....

Return to “Issues”