IE浏览器兼容性问题

1、input中文字垂直居中问题

  解决方案:在IE中需要将height和line-height设置成一样,但是如果height过大,在chorme浏览器中光标跟input的height一样高。需要给input的height设定一个较小的高度,然后用padding去填充。(完美解决)
  使用示例: height: 22px;line-height: 22px; padding:10px 0;

2、图片或div圆角问题

  解决方案:border-radius在IE下不兼容,使用DD_roundies_0.0.2a-min.js可基本解决。(较完美解决)
  使用示例引用js文件,DD_roundies.addRule('.user_avatar', '100%');或 DD_roundies.addRule('.user_avatar', '5px');
  下  载:DD_roundies_0.0.2a-min.js

3、IE8及以下input背景透明而文字不透明

  解决方案:使用IE滤镜让背景色透明,模拟rgba效果。(效果一般)
  使用示例filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#BF000000,endColorstr=#BF000000); 我们需要留意的是StartColorStr和EndColorStr的值,前两位是十六进制的透明度,后面六位是十六进制的颜色。换算方法:x=alpha*255 将计算的结果x转换成十六进制即可。

4、IE8及以下不显示placeholder

  解决方案:使用js解决,直接引用。(不完美,提交时会直接提交placeholder的值)
  下  载:jquery.placeholder.js

5、slideUp、slideDown在IE中的闪动及文字错位
  解决方案:由于容器使用了position的relative或者absolute导致,不用这个属性即可。(暂时未找到更好的解决方案)

6、ie中绝对定位被相对定位挡住

  父元素为position:relative,子元素为position:absolute,当子元素弹出时会被父元素遮挡。
  解决方案:动态改变相对定位的父元素的z-index(样式中无需设置),子元素弹出时利用JS将this的父元素设置为z-index:1,鼠标移出后改回z-index:0。

$(document).on("click", ".warn_item .warn_title i", function () {
    $(".warn_submenu").css("display", "none");
    $(".warn_item").css("z-index", "0");
    $(this).parent().parent().parent().parent().find(".warn_submenu").css("display", "block");
    $(this).parent().parent().parent().parent().css("z-index", "1");
    return false;
});

$(document).click(function () {
    $(".warn_submenu").css("display", "none");
    $(".warn_item").css("z-index", "0");
});

 

posted @ 2015-03-03 08:19  sphinxhero  阅读(384)  评论(0)    收藏  举报