还有什么可能导致问题..?
我在Chrome和Firefox中试过这个,它工作正常....文件首先加载...也许尝试运行下面的代码,看看这是否在你的Firefox上做同样的事情...?
但它可能是FF版本,也可能是jQuery版本。
我有FF 56.0(32位),它的更新,因为我们说话:-P 和jQuery 2.2.4
<!doctype html>
<html>
<head>
<title>Quick Loading test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
</head>
<body>
<h1>testing</h1>
<img src="http://www.guoguiyan.com/data/out/113/69175307-large-wallpapers.jpeg">
<script>
$(window).on('load', function() {
$('body').removeClass('active');
console.log('window load');
});
$(document).ready(function($) {
$('body').addClass('active');
console.log('doc ready');
});
</script>
</body>
</html>
我发现关于该此链接...
https://github.com/jquery/jquery/issues/3194
所以也许试试
$(window).on('load', function() {
$('body').removeClass('active');
console.log('window load');
});
$(function() {
$('body').addClass('active');
console.log('doc ready');
});
你是否检查哪一个先运行? –
@FastSnail加载函数首先在Firefox中运行,并且ready函数首先在Chrome中运行。 现在我得到了原因,但我该如何实现呢? –
你能解释一下你在做什么? –