jQuery,循环错误:$(“ul#slides”).cycle 不是函数 [Bei diesem Fehler anhalten] next: '#next',

发布于 2024-12-22 08:13:15 字数 1149 浏览 2 评论 0原文

我的代码中出现以下错误 $("ul#slides").cycle is not a function 。 我是一个新手,所以我对 JS 和 jQuery 都一无所知,所以如果有人能帮助我那就太好了。

这是我的代码:

JS

$(document).ready(function () {
    $("#slideshow").css("overflow", "hidden");
    $("ul#slides").cycle({
        fx: 'fade',
        pause: 1,
        prev: '#prev',
        next: '#next',
    });
    $("#slideshow").hover(function () {
        $("ul#nav").fadeIn();
    }, function () {
        $("ul#nav").fadeOut();
    });

});

HTML

<div id="slideshow">
    <ul id="nav">
        <li id="prev"><a href="#">Prev</a></li>
        <li id="next"><a href="#">Next</a></li>
    </ul>

    <ul id="slides">
        <li><img src="Images/01.png" alt="Harley Davidson Sportster" /></li>
        <li><img src="Images/02.jpg" alt="Harley Davidson Sportster" /></li>
        <li><img src="Images/03.jpg" alt="Harley Davidson Sportster" /></li>
    </ul>
</div>

感谢您的帮助。

I get the following error $("ul#slides").cycle is not a function in my code.
I am a newbie, so I have no idea of JS neither from jQuery so if anybody can help me could be great.

Here are my codes:

JS

$(document).ready(function () {
    $("#slideshow").css("overflow", "hidden");
    $("ul#slides").cycle({
        fx: 'fade',
        pause: 1,
        prev: '#prev',
        next: '#next',
    });
    $("#slideshow").hover(function () {
        $("ul#nav").fadeIn();
    }, function () {
        $("ul#nav").fadeOut();
    });

});

HTML

<div id="slideshow">
    <ul id="nav">
        <li id="prev"><a href="#">Prev</a></li>
        <li id="next"><a href="#">Next</a></li>
    </ul>

    <ul id="slides">
        <li><img src="Images/01.png" alt="Harley Davidson Sportster" /></li>
        <li><img src="Images/02.jpg" alt="Harley Davidson Sportster" /></li>
        <li><img src="Images/03.jpg" alt="Harley Davidson Sportster" /></li>
    </ul>
</div>

Thank for the help.

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

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

发布评论

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

评论(2

﹉夏雨初晴づ 2024-12-29 08:13:15

我会查看您包含的 jquery 版本,并确保没有任何冲突。通常,当我看到这个问题时,这是由于插件需要不同的 jquery 库以及它们的引用顺序而引起的头痛。尝试注释掉该功能不需要的所有 jquery 库(包括母版页中的任何库),然后查看是否仍然存在错误。如果是这样,那么制作一个仅具有此功能的小型简单示例 html 页面

I would look at the versions of jquery that you are including and make sure you don't have any conflicts. Often when I've seen this problem it is a result of plugins that require different jquery libraries and the order that they are referenced cause headaches. Try commenting out any jquery libraries that are not required for the function (including any in master pages) and see if it still has the error. If so then make a small bare bones sample html page with just this functionality

过去的过去 2024-12-29 08:13:15

如果您链接到多个 JQuery 库,则可能会发生冲突。我正在使用循环插件 https://ajax .googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js 它与我的所有 .js 脚本一起运行良好。

If you are linking to more than one JQuery library it's probably conflicting. I am using the cycle plugin w/ https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js and it's working well w/ all of my .js scripts.

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