【发布时间】:2013-01-18 18:35:42
【问题描述】:
我根据 youtube 教程制作了一个网站。 Here's my test site。和 here's the tutorial (final step of 3) 如果有帮助。尚未使用 CSS。
当我单击菜单中的链接时。一切都像想象的那样消失。但在淡入淡出动画结束时上一页闪烁。
我
我对 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;
});
【问题讨论】:
-
你是对的。但我无法让 index.php 工作。 =/ 所以我提交了我的测试站点 ...
标签: php jquery menu fadein flicker