gpt4 book ai didi

javascript - 在html中包含外部js和css文件

转载 作者:行者123 更新时间:2023-11-28 03:28:57 25 4
gpt4 key购买 nike

是巴拉。我在 html 中添加外部 css 和 js 文件时遇到问题。

下面的代码不起作用:

$( window ).ready(function() {
var wHeight = $(window).height();
$('.slide')
.height(wHeight)
.scrollie({
scrollOffset : -50,
scrollingInView : function(elem) {

var bgColor = elem.data('background');

$('body').css('background-color', bgColor);
}
});

});
* { box-sizing: border-box }

body {
font-family: 'Coming Soon', cursive;
transition: background 1s ease;
background: #3498db;
width: 100px;
height: 100px;
}

p {
color: #ecf0f1;
font-size: 2em;
text-align: center;

}

span {
clear: both;
font-size: .7em;
color: #bdc3c7;
}

a {
color: #c0392b;
text-decoration: none;
}

.slide {

.inside {
display: table;
height: 100%;
width: 100%;
padding: 0 3em;

p {
display: table-cell;
width: 100%;
clear: both;
vertical-align: middle;
text-align: center;
}
}
}
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script type="text/javascript" src="code.js"></script>
<link rel="stylesheet" type="text/css" href="2.css" />
</head>
<body>
</body>
</html>

最佳答案

试试这个。用这个替换 link 标签:

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

但这也取决于您的 css 文件的存储位置。我不确定您为什么要发布 JS 部分。也许你可以解释一下?

关于javascript - 在html中包含外部js和css文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44841447/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com