我使用3 html,1与页眉,1页脚,另一个与一切的基础。 我加载页眉和页脚用下面的代码加载脚本javascript
jQuery(document).ready(function ($) {
$('#header-load').load('/app/templates/header.html', function() {
console.log('header loaded')
});
$('#footer-load').load('/app/templates/footer.html', function() {
console.log('footer loaded')
});
$('.dropdown').on('show.bs.dropdown', function (e) {
$(this).find('.dropdown-menu').first().stop(true, true).slideDown(300);
});
$('.dropdown').on('hide.bs.dropdown', function (e) {
$(this).find('.dropdown-menu').first().stop(true, true).slideUp(200);
});
})
在基础HTML,这是以下
<!DOCTYPE html>
<html class="no-focus" lang="en">
<head>
<meta charset="utf-8">
<title>Home</title>
<link rel="stylesheet" id="css-main" href="/public/css/app.css">
<!-- END Stylesheets -->
</head>
<body>
<!-- Page Container -->
<div id="page-container" class="">
<!-- Header -->
<div id="header-load"></div>
<!-- END Header -->
<!-- Main Container -->
<main id="main-container">
</main>
<!-- END Main Container -->
<!-- Footer -->
<div id="footer-load"></div>
<!-- END Footer -->
</div>
<!-- END Page Container -->
<!-- JS-->
<script src="/public/library/jquery/dist/jquery.min.js"></script>
<script src="/public/library/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="/public/js/app.js"></script>
</body>
</html>
我在app.js一个函数要加载到了header.html ,但它不工作..
负载的页眉和页脚,但其他功能不
有您尝试使用而非公共/库/ jquery/dist/jquery.min.js? –
你在控制台中得到的任何错误? – Krishna9960
在控制台没有错误,这是最奇怪的事情:( –