我试图用jquery创建一个简单的网站http://cone.hostei.com/index3.html。我只想使用函数将html页面加载到div中。问题是,功能 - $('.preloader').hide()
和({ opacity : 1 }
),火灾之前,页面及其图像完全加载到一个div!我该如何解决它?Jquery加载页面
$(window).load(function() {
$('li a').click(function() { //event on click
var toLoad = $(this).attr('href'); //get href of a li element
$('.load-in').fadeOut('fast', loadContent);
$('.loader').show(); //show the loader
function loadContent() {
$('.load-in').css({ //set opacity 0.3
opacity: 0.3
}).load(toLoad, hideLoad); //load html page, then callback
};
function hideLoad() {
$('.load-in').fadeIn('fast',
function() { //hide preloader and set opacity 1
$('.loader').fadeOut('fast');
$('.load-in').animate({
opacity: 1
});
});
};
return false;
});
});
你的问题不清楚。没有冒犯性,代码在你的页面上结构也很差。要破译你的意图是非常困难的。 – 2013-04-10 02:47:35
您需要将相关代码复制到问题中,而不仅仅是指向网页的链接 – 2013-04-10 02:58:43