这段代码适用于谷歌浏览器等,但它不适用于 IE,有谁知道为什么或我做错了什么?
我有 IE11,这必须在 Internet Explorer 上工作。
点击虚线
$('.on').hide();
$('.off, .on').on('click',
function() {
$('.off, .on').toggle()
});
.on {
width: 100%;
position: relative;
}
.on:before {
content:'';
position: absolute;
border-bottom: 2px solid #5092e3;
width: 100%;
transform: translateY(-50%);
z-index:0;
top:50%;
}
.off {
width: 100%;
position: relative;
}
.off:before {
content:'';
position: absolute;
border-bottom: 2px dashed #666666;;
width: 100%;
transform: translateY(-50%);
z-index:0;
top:50%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<div class="off">
       
</div>
<div class="on">
       
</div>
最佳答案
我认为您必须声明 !DOCTYPE 才能在 IE8 上运行它。
-多荷兰语
关于javascript - hide() 和 on() 在 Internet Explorer (IE) 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47037931/