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 . Can I do it in nuBuilder?
Thanks
dePaula Jr.
Welcome to the nuBuilder forums!
Please register and login to view forums and other content only available to registered users.
Please register and login to view forums and other content only available to registered users.
Button with image
-
- Posts: 84
- Joined: Mon Jul 04, 2011 12:52 am
Re: Button with image
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)
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.
i hope it helps
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");
}
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+')');
}
-
- Site Admin
- Posts: 2781
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 1 time
Re: Button with image
zazzium,
This is nice!
With a slight change we you can use images stored in nuBuilder
Steven
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");
}