davebalmer / jo

Jo (0.5.0) is a thin (~16K) candy shell for making HTML5 apps. Jo works with: PhoneGap, Chrome, Safari, Opera, FireFox, iOS, Android, BlackBerry 10, Tizen, & Windows Phone 8+. Features include skinnable UI widgets, a clean event model and a light data layer.
MIT License
1.2k stars 180 forks source link

Adding Images to joButton #29

Closed reflog closed 13 years ago

reflog commented 13 years ago

Is this supported/planned? Any pointers?

davebalmer commented 13 years ago

You can do this with joButton today by including the img tag in the button "text". Like this: var x = new joButton('<img src="mybutton.png">');. Another approach would be to set the button's CSS classname to something you've setup to add a background image with CSS, like this: var y = new joButton().setStyle('okbutton');. Then have a CSS style setup for that okbutton classname to have a background image (and probably a height/width as well).

I'm looking into making a joImageButton widget in a future release which might make this a little cleaner, but would end up doing about the same thing underneath the hood.

reflog commented 13 years ago

Great, thanks! Might I suggest adding those tips to the documentation?

Thanks for your great work