jQuery 在 HTML 中添加引导程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19331210/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 23:42:01  来源:igfitidea点击:

Adding bootstrap in HTML

javascriptjqueryhtmlcsstwitter-bootstrap

提问by newbie

I'm going to use bootstrapto build up my front end. Also I'm using JSP and JSTL

我将使用引导程序来构建我的前端。我也在使用 JSP 和 JSTL

What I've read in some articles over the internet is the proper approach of adding an external javascript file should be written before the body closing tag for more optimization of the page. Now I'm trying to apply this with the bootstrap, what i did is put the cssof the bootstrap to an external html file:

我在互联网上的一些文章中读到的是添加外部 javascript 文件的正确方法应该在正文结束标记之前编写,以便对页面进行更多优化。现在我正在尝试将其与引导程序一起应用,我所做的是将css引导程序的放入外部 html 文件:

import_header.html:

import_header.html:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="bootstrap-css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="bootstrap-css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="bootstrap-css/bootstrap-responsive.css">
<link rel="stylesheet" type="text/css" href="bootstrap-css/bootstrap-responsive.min.css">

which I imported to the head of the html like this:

我像这样导入到 html 的头部:

<jsp:include page="import_header.html" flush="true" />

Now I want to do the same thing with the jsfile of the of the bootstrap and the jQuerylib but I don't know what is the proper way of doing this.

现在我想对jsbootstrap 和jQuerylib的文件做同样的事情,但我不知道这样做的正确方法是什么。

回答by

that's the recommended way, how to place them:

这是推荐的方式,如何放置它们:

e.g. footer.html

例如footer.html

        <!-- Placed at the end of the document so the pages load faster -->
        <script src="jquery/jquery-2.0.3.min.js"></script>
        <script src="bootstrap/bootstrap-2.3.1.min.js"></script>
        <script src="myOwn.js"></script>
    </body>
</html>