我无法运行我的javascript

时间:2021-11-18 08:09:25

This is head section of my code bringing my Javascript and CSS libraries, but it won't run my jQuery file

这是我的代码的主要部分带来我的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 those that are asking this is the Jquery I'm trying to run

那些问这个的人是我想要跑的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);

1 个解决方案

#1


2  

Just a guess:

只是一个猜测:

You have:

<link rel = "stylesheet" href = "bower_componets/bootstrap/dist/css/bootstrap.min.css">

Then you have:

然后你有:

<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>

I'm guessing you mistyped bower_componets and bower_component, which both should probably be: bower_components.
That means you're probably not loading jquery and bootstrap.

我猜你错误输入了bower_componets和bower_component,两者都应该是:bower_components。这意味着你可能没有加载jquery和bootstrap。

Give this a try:

尝试一下:

<link rel = "stylesheet" href = "bower_components/bootstrap/dist/css/bootstrap.min.css">

and:

<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>

#1


2  

Just a guess:

只是一个猜测:

You have:

<link rel = "stylesheet" href = "bower_componets/bootstrap/dist/css/bootstrap.min.css">

Then you have:

然后你有:

<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>

I'm guessing you mistyped bower_componets and bower_component, which both should probably be: bower_components.
That means you're probably not loading jquery and bootstrap.

我猜你错误输入了bower_componets和bower_component,两者都应该是:bower_components。这意味着你可能没有加载jquery和bootstrap。

Give this a try:

尝试一下:

<link rel = "stylesheet" href = "bower_components/bootstrap/dist/css/bootstrap.min.css">

and:

<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>