当前编码一个配合组合,而不是我的惊讶代码没有在IE中加载!jQuery不在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/
你有几个ID为`#main`的元素吗? – 2011-04-15 17:52:59
@Felix - 这是我认为的第一件事,所以我改变了这一点,仍然没有运气。如果你在页面加载时注意到它会加载相关的URL +类'页' – daryl 2011-04-15 17:58:04
@tfbox:这不是问题,但你可以写`$('#main')。fadeIn()`而不是`$(this ).parent()。find('#main')。fadeIn()` – 2011-04-15 18:00:54