【发布时间】:2012-02-28 22:32:07
【问题描述】:
是否可以将宽度设置为选项?我尝试了很多方法来做到这一点,但直到现在,什么都没有:( 只有在 IE 上我有这个问题。已经试过了:
jQuery:
$( "select" ).toggle(
function() {
$( "option" ).animate({
width: 500
}, 1000 );
},
function() {
$( "option" ).animate({
width: 240
}, 1000 );
}
);
--其他 jQuery--
$("select")
.mouseover(function(){
$(this)
.data("origWidth", $(this).css("width"))
.css("width", "auto");
})
.mouseout(function(){
$(this).css("width", $(this).data("origWidth"));
});
-- css--
option{
width:auto;
}
--在 IE 以外的其他浏览器上都可以完美运行--
如果有人能帮我解决这个问题,我将不胜感激。
检查小提琴示例:http://jsfiddle.net/DCjYA/173/
【问题讨论】: