2012-09-05 72 views
0

是否有可能使用jQuery buttonset()将图像作为背景?jQuery按钮图像

我试着用这个标记,但设计砸了:

<input type="radio" id="radio1" name="radio" /> 
    <label for="radio1" id="lbl1"> 
     <img src="images/red.png" /> 
    </label> 
    <input type="radio" id="radio2" name="radio" checked="checked" /> 
    <label for="radio2"> 
     <img src="images/blue.png" /> 
    </label> 
    <input type="radio" id="radio3" name="radio" /> 
    <label for="radio3"> 
     <img src="images/orange.png" /> 
    </label> 

enter image description here

我用Google搜索插件,但没有找到我所需要的。

有人试过吗?

回答

0

您可以检查此琴:

http://jsfiddle.net/c3KmQ/

它的使用jQueryUI的buttonset,这是很容易定制:

$("#radio").buttonset(); 
$($('.ui-button')[0]).addClass('bgcolor-red'); 
$($('.ui-button')[2]).addClass('bgcolor-black'); 
+0

很抱歉的延迟反应。谢谢,这看起来像我需要的,但我得到了“Uncaught SyntaxError:意外的令牌非法”与上述。 – Rivka