jQuery按钮主要&次要

时间:2010-10-23 20:41:22

标签: jquery jquery-ui button

我在项目中使用jQuery按钮,我需要显示橙色的主按钮和灰色的辅助按钮;但对我来说,两个按钮的颜色都是灰色。我使用以下代码:

$(function() {

        $( "button, input:submit").button({ icons: {primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'} });

    });

2 个答案:

答案 0 :(得分:1)

“主要”和“次要”参数用于将多个图标放在同一个按钮上。

要以不同方式设置不同的按钮,您需要分别调用button()。类似的东西:

$('#main_button').button({icons: {primary:'ui-icon-gear'} });
$('#other_button').button({icons: {primary:'other-icon'} });

编辑:我看不到你如何使用button()调用设置背景颜色。也许尝试这样的事情:

#other_button { background-color: orange;}
#other_button:hover { background-color: darker-orange;}

答案 1 :(得分:0)

我可以通过转到theme roller获得辅助按钮样式,将按钮自定义为正确的背景颜色,然后下载自定义包。将背景添加到项目中,并为按钮添加自定义CSS样式。

.custom-button
{
    background: #f47d20 url(../content/images/ui-bg_glass_75_f47d20_1x400.png) 50% 50% repeat-x !important;
}