最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Bootstrap, jQuery, Popper, and CSS load order - Stack Overflow

matteradmin10PV0评论

I'm not sure my load order is correct. Can someone make sure it is?

In "head" :

<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/style.css">

In "body" :

<script src="js/bootstrap.js"</script>
<script src="js/jquery-3.2.1.min.js"</script>
<script src="js/jquery-slim.min.js"</script>
<script src="js/popper.min.js"</script>
<script src="js/custom.js"></script>

I'm not sure my load order is correct. Can someone make sure it is?

In "head" :

<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/style.css">

In "body" :

<script src="js/bootstrap.js"</script>
<script src="js/jquery-3.2.1.min.js"</script>
<script src="js/jquery-slim.min.js"</script>
<script src="js/popper.min.js"</script>
<script src="js/custom.js"></script>
Share Improve this question edited Nov 19, 2017 at 2:39 Neil 14.3k3 gold badges35 silver badges53 bronze badges asked Nov 19, 2017 at 2:30 TomahawkTomahawk 311 silver badge3 bronze badges 4
  • 1 For your js scripts, jquery should be first since bootstrap depends on jquery – JJJ Commented Nov 19, 2017 at 2:40
  • CSS is okay. JS: 1) jQuery 3.2.1.min.js 2) bootstrap.js 3) popper.min.js 4) custom.js --- Just TRASH jquery-slim.min.js since it is another version of jQuery, but without Ajax and animations (reference here), so it's already loaded... Don't load it twice. – Louys Patrice Bessette Commented Nov 19, 2017 at 2:48
  • See the Docs BootstrapJS is reliant on jQuery and PopperJS (they need to be placed prior to BootstrapJS). See the Starter Template for an example. – vanburen Commented Nov 19, 2017 at 4:43
  • 1 Possible duplicate of script order for jquery with bootstrap – adiga Commented Nov 19, 2017 at 8:54
Add a ment  | 

2 Answers 2

Reset to default 5

In "head" :

<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">

In "body" :

<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/custom.min.js"></script>

Try using the minified version they are much smaller therfore much faster to load

Check this out !

In head :

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn./bootstrap/4.0.0-beta.2/css/bootstrap.min.css" crossorigin="anonymous">
<!-- CUSTOME STYLE CSS-->
<link href="https://fonts.googleapis./css?family=Roboto" rel="stylesheet">
<link rel="stylesheet" href="style.css">

In Body :

<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery./jquery-3.2.1.slim.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/popper.js/1.12.3/umd/popper.min.js" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn./bootstrap/4.0.0-beta.2/js/bootstrap.min.js" crossorigin="anonymous"></script>

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far