【发布时间】:2014-04-23 13:57:59
【问题描述】:
嗨,我被困在这个问题上。
我想实现一个 jquery 脚本,它将淡出我的内容 div, 更新 css 文件并淡入新内容而不重新加载页面。
这是目前为止的代码:
$(document).ready(function() {
//handle menu clicks
$('ul.navlist li a, .actlogo-link').click(function() {
var page = $(this).attr('href');
$('#home-container').fadeOut('slow', function(){
$('#main-container').load(page, function(){
$('#home-container').fadeIn('slow');
});
});
return false;
});
});
有什么想法吗?
HTML 代码
<html>
<head>
<title>Sparks Production Services • File Not Found</title>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/menu.js"></script>
<link rel="stylesheet" type="text/css" href="styles/style.css" />
</head>
<body>
<div id="main-container">
<ul class="navlist">
<li><a href="index.html"><b>Home</b></a></li>
<li><a href="hello.html">Hello</a></li>
</ul>
<div id="home-container" style="height: 100px; margin-top:15px;">
<h1 align="center" style="padding-top:10px;">Whoops! This is embarrassing.</h1>
<h3 align="center" style="padding-top:10px;">Sorry, the page you are after cannot be found. </h3>
</div>
</div>
</body>
</html>
【问题讨论】:
-
@Tamizh HTML 添加:)
标签: jquery html css fadein reload