当前位置:Gxlcms > JavaScript > jQuery解决下拉框select设宽度时IE 6/7/8下option超出显示不全

jQuery解决下拉框select设宽度时IE 6/7/8下option超出显示不全

时间:2021-07-01 10:21:17 帮助过:4人阅读

个人做了一些自定义的修改
代码如下:

<!--[if lt IE 9]>
<script type="text/javascript">
jQuery(function($){
var el;

$("select").each(function() {
el = $(this);
el.data("origWidth", el.css("width"));
// el.data("oriWidth",85);
})
.focusin(function(){
el=$(this);
el.css("width", "auto");

//if(el.width() < el.data("oriWidth")){
// el.css("width", el.data("origWidth"));
//}

})
.bind("blur change ", function(){
el = $(this);
el.css("width", el.data("origWidth"));
});
});
</script>
<![endif]-->

人气教程排行