物质izecss unturef typeError:$(...)。旋转木马不是功能

发布于 2025-02-05 11:01:26 字数 1520 浏览 2 评论 0原文

在使用positalizecss框架的同时,我从! :

Uncaught TypeError: $(...).carousel is not a function
at HTMLDocument.<anonymous> (index.html:48:24)
at e (jquery.min.js:2:30038)
at t (jquery.min.js:2:30340)

在使用jQuery和positalizecss框架时:

<html>
<head>
    <!--Import Google Icon Font-->
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <!-- Compiled and minified CSS -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">

    <!-- Compiled and minified JavaScript -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
    <!--Let browser know website is optimized for mobile-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>

<body>

    <div class="carousel">
        <a class="carousel-item" href="#one!"><img src="http://2.ngsoft.de/E3sAmcr">Hallo</a>
        <a class="carousel-item" href="#two!"><img src="http://2.ngsoft.de/9i7nKEo"></a>
    </div>


<script>
    $(document).ready(function(){
        $('.carousel').carousel();
    });

</script>

</body>
</html>

我想我没有加载两次...

i got this console error while using MaterializeCss framework from https://materializecss.com/carousel.html#one! :

Uncaught TypeError: $(...).carousel is not a function
at HTMLDocument.<anonymous> (index.html:48:24)
at e (jquery.min.js:2:30038)
at t (jquery.min.js:2:30340)

While using jQuery and MaterializeCss framework:

<html>
<head>
    <!--Import Google Icon Font-->
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <!-- Compiled and minified CSS -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">

    <!-- Compiled and minified JavaScript -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
    <!--Let browser know website is optimized for mobile-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>

<body>

    <div class="carousel">
        <a class="carousel-item" href="#one!"><img src="http://2.ngsoft.de/E3sAmcr">Hallo</a>
        <a class="carousel-item" href="#two!"><img src="http://2.ngsoft.de/9i7nKEo"></a>
    </div>


<script>
    $(document).ready(function(){
        $('.carousel').carousel();
    });

</script>

</body>
</html>

I think i do not have jQuery loaded twice...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

记忆之渊 2025-02-12 11:01:26

好吧,我明白了,我只需要在jQuery脚本加载之前

Okay I got it, I just had to load the jQuery script before the MaterializeCss one... Thats all

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文