我从YouTube教程制作了一个网站。 Here's my test site。如果有帮助,可以使用 here's the tutorial (final step of 3)。尚未使用CSS。加载时为什么fadeIn闪烁?
当我点击菜单中的链接。一切都像所想的那样消失。但在淡出动画结束时,前一页闪烁。
Me
我完全不熟悉JavaScript。
的index.php:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SuperFresh</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<a class="menu_top" href="pages/home.php">Home</a>/
<a class="menu_top" href="pages/portfolio.php">Portfolio</a>/
<a class="menu_top" href="pages/contact.php">Contact</a>/
<div id="content_area"></div>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="js/nav.js"></script>
</body>
</html>
nav.js:
$(document).ready(function() {
$('#content_area').load($('.menu_top:first').attr('href'));
});
$('.menu_top').click(function() {
var href=$(this).attr('href');
$('#content_area').hide('slow').load(href).fadeIn('slow');
return false;
});
一个的jsfiddle将有助于 –
你是对的。但我无法让index.php工作。 = /所以我提交我的测试网站... – naPalmqvist