Page 1 of 1

Button with image

Posted: Thu Mar 15, 2012 6:13 pm
by dpaulajr
Hi, Steven!

1. Is it possible to put a image in a button?

2. I am migrating a system that has a main page like
DATAPETI 1.zip
. Can I do it in nuBuilder?

Thanks

dePaula Jr.

Re: Button with image

Posted: Wed Mar 21, 2012 11:19 pm
by admin
dpaulajr,

Sorry, not with nuBuilder.


Steven

Re: Button with image

Posted: Wed May 30, 2012 8:25 pm
by zazzium
Here is one way how it could be done with jquery.
The code goes to CustomCode/Javascript.
(The function 'buttonPicture' assumes that you have a 'icons' folder in productionnu2 folder, where the icons are)

Code: Select all

function nuLoadThis(){
    buttonPicture("#nuActionSave","disk.png");
    buttonPicture("#nuActionClone","disk_multiple.png");
    buttonPicture("#nuActionDelete","delete.png");
}

function buttonPicture(id,pic){
    $(id).css("padding-left","25px");
    $(id).css("background-image","url(icons/"+pic+")");
    $(id).css("background-repeat","no-repeat");
    $(id).css("background-position","5px 4px");
}
Image

But way cooler thing u could to with it is to add custom value to a button .
Like the button 'Test button (3)' where the number 3 could be a count result from MySql query.

Code: Select all

function nuLoadThis(){
    var somevalue = 3; 
   buttonValue("#testButtonFieldName",somevalue);

}
function buttonValue(id,val){
    $(id).attr('value', $(id).attr('value')+' ('+val+')');
}

i hope it helps

Re: Button with image

Posted: Mon Jul 09, 2012 5:24 am
by admin
zazzium,

This is nice!

With a slight change we you can use images stored in nuBuilder

Code: Select all

function nuLoadThis(){
    buttonPicture("#nuActionSave",getImage("disk");
}

function buttonPicture(id,pic){
    $(id).css("padding-left","25px");
    $(id).css("background-image","url("+pic+")");
    $(id).css("background-repeat","no-repeat");
    $(id).css("background-position","5px 4px");
}
Capture.PNG
Steven