casey palmer
Posts: 0
Joined: Tue Mar 18, 2014 6:32 am

center button background image

Hello,

I am trying to play around with setting an image for a button background.

I have uploaded the image using the Media Manager, image is named "test1.png... I use this below on page load

Appery("mobilebutton_57").css("background-image", 'url(' + Appery.getImagePath('test1') + ".png" + ')');

have class assigned to button to size the button..

.imageButton {
width: 60px;
height:60px;
}

When i test the app it looks like the image is tilled and not centered.. Can you tell me how or what I can do to center the background image. See Image attached.

Image

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

center button background image

Hi Casey,

You could use this code:preApperyio("mobilebutton_57").css('background-position','center');
Apperyio("mobilebutton_57").css('position', 'absolute');/pre

casey palmer
Posts: 0
Joined: Tue Mar 18, 2014 6:32 am

center button background image

That changed it a little... see image.. Image

casey palmer
Posts: 0
Joined: Tue Mar 18, 2014 6:32 am

center button background image

I think i may have resolved it..

Thanks to your help I also added....

Apperyio("mobilebutton_57").css('background-repeat', 'no-repeat');

Now I just need to resize my images to work and I think I will be good. Thanks.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

center button background image

Casey,

Glad to hear that! Let us know if you need any further help.

Return to “Issues”