我无法让 javascript 达到 运行
I can't get my javascript to run
这是我的 Javascript 和 CSS 库代码的主要部分,但它不会 运行 我的 jQuery 文件
<link rel = "stylesheet" href = "bower_componets/bootstrap/dist/css/bootstrap.min.css">
<link rel = "stylesheet" href = "darkly.css">
<link rel = "stylesheet" href = "HistorySytleSheet.css"/>
<script type = "text/javascript" src = "bower_component/jquery/dist/jquery.min.js"></script>
<script type = "text/javascript" src = "bower_component/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src = "HistoryJQ.js"></script>
fir 那些问这是 Jquery 我正在尝试 运行
var main = function () {
$('arrow-next').click(function () {
var currentSlide = $('active-slide');
var nextSlide = currentSlide.next();
var currentDot = $('active-dot');
var nextDot = currentDot.next();
if(nextSlide.length === 0)
{
nextSlide = $('.slide').first();
nextDot = $('.dot').first();
}
currentSlide.fadeOut(600).removeClass('active-slide');
nextSlide.fadeIn(600).addClass('active-slide');
currentDot.removeClass('active-dot');
nextDot.addClass('active-dot');
});
$('.arrow-prev').click(function() {
var currentSlide = $('.active-slide');
var prevSlide = currentSlide.prev();
var currentDot = $('.active-dot');
var prevDot = currentDot.prev();
if(prevSlide.length === 0) {
prevSlide = $('.slide').last();
prevDot = $('.dot').last();
}
currentSlide.fadeOut(600).removeClass('active-slide');
prevSlide.fadeIn(600).addClass('active-slide');
currentDot.removeClass('active-dot');
prevDot.addClass('active-dot');
});
};
$(document).readyState(main);
只是猜测:
你有:
<link rel = "stylesheet" href = "bower_componets/bootstrap/dist/css/bootstrap.min.css">
那么你有:
<script type = "text/javascript" src = "bower_component/jquery/dist/jquery.min.js"></script>
<script type = "text/javascript" src = "bower_component/bootstrap/dist/js/bootstrap.min.js"></script>
我 猜测 你打错了 bower_componets
和 bower_component
,这两个应该是:bower_components
.
这意味着您可能没有加载 jquery 和 bootstrap。
试一试:
<link rel = "stylesheet" href = "bower_components/bootstrap/dist/css/bootstrap.min.css">
和:
<script type = "text/javascript" src = "bower_components/jquery/dist/jquery.min.js"></script>
<script type = "text/javascript" src = "bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
这是我的 Javascript 和 CSS 库代码的主要部分,但它不会 运行 我的 jQuery 文件
<link rel = "stylesheet" href = "bower_componets/bootstrap/dist/css/bootstrap.min.css">
<link rel = "stylesheet" href = "darkly.css">
<link rel = "stylesheet" href = "HistorySytleSheet.css"/>
<script type = "text/javascript" src = "bower_component/jquery/dist/jquery.min.js"></script>
<script type = "text/javascript" src = "bower_component/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src = "HistoryJQ.js"></script>
fir 那些问这是 Jquery 我正在尝试 运行
var main = function () {
$('arrow-next').click(function () {
var currentSlide = $('active-slide');
var nextSlide = currentSlide.next();
var currentDot = $('active-dot');
var nextDot = currentDot.next();
if(nextSlide.length === 0)
{
nextSlide = $('.slide').first();
nextDot = $('.dot').first();
}
currentSlide.fadeOut(600).removeClass('active-slide');
nextSlide.fadeIn(600).addClass('active-slide');
currentDot.removeClass('active-dot');
nextDot.addClass('active-dot');
});
$('.arrow-prev').click(function() {
var currentSlide = $('.active-slide');
var prevSlide = currentSlide.prev();
var currentDot = $('.active-dot');
var prevDot = currentDot.prev();
if(prevSlide.length === 0) {
prevSlide = $('.slide').last();
prevDot = $('.dot').last();
}
currentSlide.fadeOut(600).removeClass('active-slide');
prevSlide.fadeIn(600).addClass('active-slide');
currentDot.removeClass('active-dot');
prevDot.addClass('active-dot');
});
};
$(document).readyState(main);
只是猜测:
你有:
<link rel = "stylesheet" href = "bower_componets/bootstrap/dist/css/bootstrap.min.css">
那么你有:
<script type = "text/javascript" src = "bower_component/jquery/dist/jquery.min.js"></script>
<script type = "text/javascript" src = "bower_component/bootstrap/dist/js/bootstrap.min.js"></script>
我 猜测 你打错了 bower_componets
和 bower_component
,这两个应该是:bower_components
.
这意味着您可能没有加载 jquery 和 bootstrap。
试一试:
<link rel = "stylesheet" href = "bower_components/bootstrap/dist/css/bootstrap.min.css">
和:
<script type = "text/javascript" src = "bower_components/jquery/dist/jquery.min.js"></script>
<script type = "text/javascript" src = "bower_components/bootstrap/dist/js/bootstrap.min.js"></script>