Jquery bxslider异常 [英] Jquery bxslider exception

查看:96
本文介绍了Jquery bxslider异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧所以问题对我来说基本上是未知的,从来没有过。
我今天尝试添加bxslider,但它似乎无法正常工作。我尝试使用他提供的其他版本的JS,但同样的事情发生,图像继续加载,他们永远不会加载。我检查了元素,这就是我得到的东西

Alright so the problem is basically unknown for me, never had it before. I tried adding bxslider today but it seems it doesnt work properly. I tried using the other version of the JS that he provided but same thing happends, the images keep on "loading" and they never load. I did inspect element and this is what I got


jQuery.Deferred异常:无法读取未定义的属性'indexOf'
TypeError :无法在jQuery.fn.load中读取未定义
的属性'indexOf'(file:/// C:/Users/Oploditelj/Desktop/domaci_last/js/jquery-3.0.0.js:9612:12) HTMLImageElement的
。 (file:/// C:/Users/Oploditelj/Desktop/domaci_last/js/plugin/jquery.bxslider.min.js:10:4394)
at Function.each(file:/// C:/ Users / Oploditelj / Desktop / domaci_last / js / jquery-3.0.0.js:359:19)
at jQuery.each(file:/// C:/ Users / Oploditelj / Desktop / domaci_last / js / jquery -3.0.0.js:152:17)HTMLImageElement的
。 (file:/// C:/Users/Oploditelj/Desktop/domaci_last/js/plugin/jquery.bxslider.min.js:10:4355)
at Function.each(file:/// C:/ Users / Oploditelj / Desktop / domaci_last / js / jquery-3.0.0.js:359:19)
at jQuery.each(file:/// C:/ Users / Oploditelj / Desktop / domaci_last / js / jquery -3.0.0.js:152:17)
at g(file:/// C:/Users/Oploditelj/Desktop/domaci_last/js/plugin/jquery.bxslider.min.js:10:4295)
at c(file:/// C:/Users/Oploditelj/Desktop/domaci_last/js/plugin/jquery.bxslider.min.js:10:4180)
at d(file:// /C:/Users/Oploditelj/Desktop/domaci_last/js/plugin/jquery.bxslider.min.js:10:2570)
undefined

jQuery.Deferred exception: Cannot read property 'indexOf' of undefined TypeError: Cannot read property 'indexOf' of undefined at jQuery.fn.load (file:///C:/Users/Oploditelj/Desktop/domaci_last/js/jquery-3.0.0.js:9612:12) at HTMLImageElement. (file:///C:/Users/Oploditelj/Desktop/domaci_last/js/plugin/jquery.bxslider.min.js:10:4394) at Function.each (file:///C:/Users/Oploditelj/Desktop/domaci_last/js/jquery-3.0.0.js:359:19) at jQuery.each (file:///C:/Users/Oploditelj/Desktop/domaci_last/js/jquery-3.0.0.js:152:17) at HTMLImageElement. (file:///C:/Users/Oploditelj/Desktop/domaci_last/js/plugin/jquery.bxslider.min.js:10:4355) at Function.each (file:///C:/Users/Oploditelj/Desktop/domaci_last/js/jquery-3.0.0.js:359:19) at jQuery.each (file:///C:/Users/Oploditelj/Desktop/domaci_last/js/jquery-3.0.0.js:152:17) at g (file:///C:/Users/Oploditelj/Desktop/domaci_last/js/plugin/jquery.bxslider.min.js:10:4295) at c (file:///C:/Users/Oploditelj/Desktop/domaci_last/js/plugin/jquery.bxslider.min.js:10:4180) at d (file:///C:/Users/Oploditelj/Desktop/domaci_last/js/plugin/jquery.bxslider.min.js:10:2570) undefined

我使用的代码与其网站上的代码完全相同。

The code that Im using is exactly the same as the one that was on their website.

<head> 
        <script type="text/javascript" src="js/jquery-3.0.0.js"></script>

        <script src="js/plugin/jquery.bxslider.min.js"></script>
        <link rel="stylesheet" type="text/css" href="js/plugin/jquery.bxslider.css"/>

        <script type="text/javascript" src="js/skripta.js"></script>


    </head> <!-- Head ends -->

当然我在单独的.js文件中调用它

and of course Im calling it inside separate .js file

$(document).ready(function() {

    $('.bxslider').bxSlider();

});

且正文是

<body> <!-- Body start -->
        <ul class="bxslider">
          <li><img src="js/plugin/images/pic1.jpg"/></li>
          <li><img src="js/plugin/images/pic2.jpg"/></li>
          <li><img src="js/plugin/images/pic3.jpg"/></li>
        </ul>

    </body><!-- Body ends -->


推荐答案

问题是关于jQuery 3.0版和兼容性 bxslider.js 。这个问题是由jQuery .load()函数引起的。您必须更改 bxslider.js 的一行才能解决此问题。打开你的bxslider.js文件,找到 .load()函数的代码行。它只在 bxslider.js 中使用过一次,所以必要的更改是:

The issue is about jQuery version 3.0 and compatibility with bxslider.js. And this issue was arised by jQuery .load() function. You have to change bxslider.js's one line to solve this issue. Open your bxslider.js file and find .load() function's code line. It was used only 1 time in bxslider.js, so the necessary change is:

来自

$(this).load();

$(this).trigger('load');

这篇关于Jquery bxslider异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆