Better handling of buttons with text & image, as well as a default style.

This commit is contained in:
Nathan Gray 2013-11-25 16:50:20 +00:00
parent 5c7a290ac9
commit e942a63607
2 changed files with 17 additions and 10 deletions

View File

@ -94,10 +94,6 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM],
{
this.btn = $j(document.createElement("button"))
.addClass("et2_button et2_button_text");
if(this.options.background_image)
{
this.btn.addClass('et2_button_with_image');
}
this.setDOMNode(this.btn[0]);
}
},
@ -154,13 +150,17 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM],
src= image;
found_image = true;
}
if(this.image != null)
if(found_image)
{
this.image.attr("src", src);
}
else if (this.options.background_image)
{
this.btn.css("background-image","url("+src+")");
if(this.image != null)
{
this.image.attr("src", src);
}
else if (this.options.background_image)
{
this.btn.css("background-image","url("+src+")");
this.btn.addClass('et2_button_with_image');
}
}
}
if(!found_image)
@ -169,6 +169,7 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM],
if(this.btn)
{
this.btn.css("background-image","");
this.btn.removeClass('et2_button_with_image');
}
}
},

View File

@ -193,6 +193,12 @@ input[type=button]:focus {
color: #202d52;
outline: none;
}
button.et2_button_with_image {
padding-left: 20px;
background-repeat: no-repeat;
background-position-x: 3px;
}
/**
* Drop down button
*/