利用jQuery实现加载公共头部和底部
2017-10-28 11:38
337 查看
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>把头部和尾部通过jquery加载进页面</title>
<link rel="shortcut icon" href="../favicon.ico" />
<style>
body{text-align: center;}
</style>
</head>
<body>
<!--放一个id为header的div,把header.html加载到这块-->
<div id="header"></div>
<div class="main" style="width:100%;padding:100px 0;background:#dcdcdc;">
<h1>我是主体</h1>
</div>
<!--放一个id为footer的div,把footer.html加载到这块-->
<div id="footer"></div>
<!--利用jquery的load()方法把header.html和footer.html加载进来 -->
<script type="text/javascript" src="../js/jquery-1.11.0.min.js" ></script>
<script>
$(function() {
$('#header').load('common/header.html');
$('#footer').load('common/footer.html');
})
</script>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>把头部和尾部通过jquery加载进页面</title>
<link rel="shortcut icon" href="../favicon.ico" />
<style>
body{text-align: center;}
</style>
</head>
<body>
<!--放一个id为header的div,把header.html加载到这块-->
<div id="header"></div>
<div class="main" style="width:100%;padding:100px 0;background:#dcdcdc;">
<h1>我是主体</h1>
</div>
<!--放一个id为footer的div,把footer.html加载到这块-->
<div id="footer"></div>
<!--利用jquery的load()方法把header.html和footer.html加载进来 -->
<script type="text/javascript" src="../js/jquery-1.11.0.min.js" ></script>
<script>
$(function() {
$('#header').load('common/header.html');
$('#footer').load('common/footer.html');
})
</script>
</body>
</html>
相关文章推荐
- jQuery实现当拉动滚动条到底部加载数据
- 使用jquery实现页面滚动到底部自动加载新的信息
- 使用jquery实现页面滚动到底部自动加载新的信息
- jQuery实现当拉动滚动条到底部加载数据
- 使用jquery实现页面滚动到底部自动加载新的信息
- 关于用jquery.masonry.js实现动态加载效果(当页面滚动条拉到底部时时重新加载图片)
- Js(JQuery)实现滚动到底部加载更多(翻页)
- 利用JQuery实现从底部回到顶部的功能
- 使用jquery实现页面滚动到底部自动加载新的信息
- Android下拉刷新库,利用viewdraghelper实现,集成了下拉刷新,底部加载更多,数据初始加载显示loading等功能
- Jquery的 scroll事件,实现当滚动条到达最底部时,自动加载新项[转]
- 使用jquery.more.js来实现点击底部更多后, 底部加载出新的数据
- jQuery实现当拉动滚动条到底部加载数据
- 使用jquery实现页面滚动到底部自动加载新的信息
- 利用jQuery的ResourceLoader插件实现JS和CSS脚本的动态按需加载
- 利用jQuery的deferred对象实现异步按顺序加载JS文件
- Jquery的 scroll事件,实现当滚动条到达最底部时,自动加载新项
- 使用jquery实现页面滚动到底部自动加载新的信息
- 利用jQuery的deferred对象实现异步按顺序加载JS文件
- 使用jquery.more.js来实现点击底部更多后, 底部加载出新的数据