如何在使用jquery.load()的内容之前加载页眉和页脚 [英] how to load header and footer before the content using jquery.load()
本文介绍了如何在使用jquery.load()的内容之前加载页眉和页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 jquery.load()
方法将页眉和页脚调入不同的页面。但是在页面加载页脚和页眉时会有延迟。那是当我运行这个我的内容..之后,只有标题显示。我想同时显示页眉,内容,页脚加载。你可以帮我一下。
< html>
< head>
< script>
$(document).ready(function(){
$(#header)。load(header.html);
$(#footer)。load footer.html);
});
< / script>
< / head>
< body>
< div id =header>< / div>
< div id =content>我的内容来了......< / div>
< div id =footer>< / div>
< / body>
< / html>
解决方案
它不适用于Google Chrome
因此,如果你想运行这个文件,你可以使用 FireFox ,否则它会在服务器上运行。
添加Jquery CDN
美好的一天!
< script type =text / javascript>
$(document).ready(function(){
$(#header)。load(header.html);
$(#footer)。load footer.html);
});
< / script>
< / head>
< body>
< div id =header>< / div>
< div id =content>我的内容在这里...
< / div>
< div id =footer>< / div>
< / body>
I am calling header and footer into different pages using jquery.load()
method. but on loading the page the footer and header s having a delay. that is when i'm running this "my content.. " comes first after that only header is showing. i want to show header, content, footer loads at same time. can you please help me.
<html>
<head>
<script>
$(document).ready(function() {
$("#header").load("header.html");
$("#footer").load("footer.html");
});
</script>
</head>
<body>
<div id="header"></div>
<div id="content">My content comes here...</div>
<div id="footer"></div>
</body>
</html>
解决方案
It will Not Work on Google Chrome(Local), So If you Want Run This File You Can use FireFox Otherwise it will Work on server.
Add Jquery CDN
Good Day!
<script type="text/javascript">
$(document).ready(function(){
$("#header").load("header.html");
$("#footer").load("footer.html");
});
</script>
</head>
<body>
<div id="header"></div>
<div id="content">My content comes here...
</div>
<div id="footer"></div>
</body>
这篇关于如何在使用jquery.load()的内容之前加载页眉和页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文