jQuery解決下拉框select設(shè)寬度時(shí)IE 6/7/8下option超出顯示不全
更新時(shí)間:2013年05月27日 17:06:47 作者:
jQuery解決IE 6/7/8 BUG:下拉框select設(shè)寬度時(shí)option超出顯示不全,經(jīng)過修改效果還不錯(cuò),遇到類似情況的朋友可以參考下哈
個(gè)人做了一些自定義的修改
<!--[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]-->
復(fù)制代碼 代碼如下:
<!--[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]-->
您可能感興趣的文章:
- jQuery獲取select選中的option的value值實(shí)現(xiàn)方法
- JQuery動(dòng)態(tài)添加Select的Option元素實(shí)現(xiàn)方法
- JS & JQuery 動(dòng)態(tài)添加 select option
- jQuery操作Select的Option上下移動(dòng)及移除添加等等
- JQuery中對(duì)Select的option項(xiàng)的添加、刪除、取值
- 刪除select中所有option選項(xiàng)jquery代碼
- 淺析jQuery對(duì)select操作小結(jié)(遍歷option,操作option)
- JQuery操作Select的Options的Bug(IE8兼容性視圖模式)
- jquery操作select option 的代碼小結(jié)
- jQuery動(dòng)態(tài)產(chǎn)生select option下拉列表
相關(guān)文章
JQuery獲取可視區(qū)尺寸和文檔尺寸及制作懸浮菜單示例
這篇文章主要介紹了JQuery獲取可視區(qū)尺寸和文檔尺寸及制作懸浮菜單,涉及jQuery針對(duì)頁(yè)面元素屬性動(dòng)態(tài)操作相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2019-05-05
jQuery滾動(dòng)插件scrollable.js用法分析
這篇文章主要介紹了jQuery滾動(dòng)插件scrollable.js用法,簡(jiǎn)單分析了scrollable.js的功能、方法及相關(guān)使用技巧,需要的朋友可以參考下2017-05-05
ASP.NET jQuery 實(shí)例18 通過使用jQuery validation插件校驗(yàn)DropDownList
這節(jié)我們還可以通過直接設(shè)置DropDownList屬性來設(shè)置jQuery validation插件的校驗(yàn)規(guī)則和提示信息2012-02-02
多種類型jQuery網(wǎng)頁(yè)驗(yàn)證碼插件代碼實(shí)例
這篇文章主要介紹了多種類型jQuery網(wǎng)頁(yè)驗(yàn)證碼插件代碼實(shí)例,有正好需要的同學(xué)可以測(cè)試研究下具體使用效果2021-01-01
Jquery知識(shí)點(diǎn)一 Jquery的ready和Dom的onload的區(qū)別
onload是所有dom元素創(chuàng)建完畢,圖片、css等都加在完畢后才觸發(fā) ready則是dom元素創(chuàng)建完畢后就被觸發(fā)2011-01-01
jquery中實(shí)現(xiàn)時(shí)間戳與日期相互轉(zhuǎn)換
本文主要利用jquery擴(kuò)展寫了一個(gè)myTime對(duì)象,并寫了2個(gè)函數(shù)分別處理日期和時(shí)間戳之間的相互轉(zhuǎn)換。2016-04-04

