![](/img/trans.png)
[英]jQuery .load not working on IE (Works fine on all other browsers)
[英]jQuery not working in IE, works in other browsers
目前正在編寫隊友檔案,對不起,該代碼未在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”方法的原因是因為我同時進行了兩種測試。
你有沒有嘗試過
$(document).ready(function() {
// Stuff to do as soon as the DOM is ready;
});
而不是window.load?
IE通常在樣式/選擇任何新的HTML5元素(例如section
和nav
遇到麻煩。 嘗試使用類似這樣的東西或簡單地使用div
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.