在研究OVERFLOW的东西,写了个程序,一直用CHROME,后来发现IE数值完全变了(有的时候第一次运行数值和CHROME一样,再运行就不一样了, 请大神看看怎么回事。
$(document).ready(function () {
$("<span />").text($(".text").text()).appendTo("#container");
$("#result").append("<span>" + $(".text").width() + "</span><br />");
$("#result").append("<span>" + $("#container span").width() + "</span><br />");
$("#result").append("<span>Overflow: " + (($("#container span").width() > $(".text").width()) ? "yes" : "no") + "</span><br />");
});
</script>
<body>
<div class="text">This is shown. This is hidden</div>
<div id="result"></div>
<div id="container" style="visibility:hidden;"></div>
</body>
显示的结果应该是
This is
100
232
Overflow: yes
IE 却是
This is shown.
100
43
Overflow: no
$("#container span").width() 这个究竟怎么了唉
Overflow: no
$(document).ready(function () {
$("<span />").text($(".text").text()).appendTo("#container");
$("#result").append("<span>" + $(".text").width() + "</span><br />");
$("#result").append("<span>" + $("#container span").width() + "</span><br />");
$("#result").append("<span>Overflow: " + (($("#container span").width() > $(".text").width()) ? "yes" : "no") + "</span><br />");
});
</script>
<body>
<div class="text">This is shown. This is hidden</div>
<div id="result"></div>
<div id="container" style="visibility:hidden;"></div>
</body>
显示的结果应该是
This is
100
232
Overflow: yes
IE 却是
This is shown.
100
43
Overflow: no
$("#container span").width() 这个究竟怎么了唉
Overflow: no
