问题描述
|
目前正在编写队友档案,对不起,该代码未在IE中加载!
我正在使用标准AJAX对其进行编码,这是相关的jQuery:
//ajax shtuff
$(window).load(function() {
// Ajax Cache!
$.ajaxSetup ({
cache: false
});
var $loadW = \'<div id=\"whiteLoader\" />\';
var $loadurl = $(\'.current\').attr(\'href\');
// Initial Page Load
$(\'#con\').prepend($loadW);
$(\'#main\').fadeOut(\'slow\',function() {
$(this).load($loadurl + \' .page\',function() {
$(this).parent().find(\'#whiteLoader\').fadeOut(\'slow\',function() {
$(this).parent().find(\'#main\').fadeIn(\'slow\').css({background: \'red\'});
$(this).remove();
});
});
});
$(\'nav ul li a\').each(function() {
$(this).click(function(e) {
var $loadW = \'<div id=\"whiteLoader\" />\';
var $loadurl = $(this).attr(\'href\');
// Prevent default hotlink
e.preventDefault();
// Add the current state
$(\'*\').removeClass(\'current\');
$(this).addClass(\'current\');
// Load the Page
$(\'#main\').fadeOut(\'slow\',function() {
$(\'#con\').prepend($loadW);
$(\'#main\').load($loadurl + \' #main\',function() {
$(\'#whiteLoader\').fadeOut(\'slow\',function() {
$(\'#main\').fadeIn(\'slow\');
$(this).remove();
});
});
});
});
});
});
从字面上看,不知道为什么这不起作用,这是到实时页面的链接(我将背景设置为红色只是为了向您展示该区域。)
也是因为初始页面使用\'this \'方法的原因是因为我同时对这两种方法进行了测试。
http://212.7.200.35/~tfBox/zee/
解决方法
IE通常在样式/选择任何新的HTML5元素(例如
section
和nav
)时遇到麻烦。尝试使用类似这样的东西或简单地使用div
,你有没有尝试过
$(document).ready(function() {
// Stuff to do as soon as the DOM is ready;
});
而不是window.load?