2012-09-05 74 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