Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

Button with image

Post Reply
dpaulajr
Posts: 3
Joined: Sat Jan 28, 2012 11:29 pm
Location: Brazil

Button with image

Unread post 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.
You do not have the required permissions to view the files attached to this post.
admin
Site Admin
Posts: 2824
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 29 times

Re: Button with image

Unread post by admin »

dpaulajr,

Sorry, not with nuBuilder.


Steven
zazzium
Posts: 84
Joined: Mon Jul 04, 2011 12:52 am

Re: Button with image

Unread post 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
admin
Site Admin
Posts: 2824
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 29 times

Re: Button with image

Unread post 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
You do not have the required permissions to view the files attached to this post.
Post Reply