Flexslider 2无法使用最新的jquery 3.2.1

时间:2017-07-23 08:08:02

标签: jquery

enter image description here

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"
  integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
  crossorigin="anonymous"></script>

1 个答案:

答案 0 :(得分:4)

.load事件已从jQuery 3中删除,因此您需要更改.load事件以使用jQuery中的on函数。 请参阅以下示例代码,在jQuery 3中初始化flex滑块实例。

原始代码:

$(window).load(function() {
    $('.flexslider').flexslider({
        animation: "fade",
        controlNav: true,
        directionNav: false,
        pauseOnHover: true,
        pauseOnAction: false
    });
});

修改了更新的代码,以便在jQuery中使用on函数:

$(window).on("load", function() {
    $('.flexslider').flexslider({
        animation: "fade",
        controlNav: true,
        directionNav: false,
        pauseOnHover: true,
        pauseOnAction: false
    });
});