jQuery Uncaught TypeError with Theme Punch Revolution Slider [英] jQuery Uncaught TypeError with Theme Punch Revolution Slider

查看:95
本文介绍了jQuery Uncaught TypeError with Theme Punch Revolution Slider的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个无法追查的问题。我正在使用函数。



我不会不推荐修复或修改你不拥有的代码,但是现在你可以通过在cssAnimationRemove函数上加上未定义的检查来修复bug:



Prettified ,原始函数如下所示:

  a.fn.cssAnimationRemove = function(){
var b = this ;
var c = b.data(cssAnimations);
var d = b.data(identity);
a.each(c,function(a,b){
c [a] = b.splice(d + 1,1);
});
b.data(cssAnimations,c);
};

修改后的美化版本只需要插入一个未定义的检查。它看起来像这样:

  a.fn.cssAnimationRemove = function(){
var b = this;
var c = b.data(cssAnimations);
var d = b.data(identity);
if(typeof c!==undefined){
a.each(c,function(a,b){
c [a] = b.splice(d + 1,1) );
});
}
b.data(cssAnimations,c);
};

在购买包含此版本滑块的主题后,我们遇到了同样的问题(我怀疑是一个较旧的版本,因为Revolution Slider网站上的文件与我们本地的文件不同。


I'm having a problem that I can't track down. I'm using the Revolution Slider and I keep on getting jQuery errors:

 ▼ Uncaught TypeError: Cannot read property 'length' of undefined (repeated 86 times)

    p.extend.each                            jquery-1.8.2.min.js:2  
    a.fn.cssAnimationRemove     jquery.themepunch.plugins.min.js:18  
    (anonymous function)        jquery.themepunch.plugins.min.js:18  

The problem is on this page and I believe it's causing the weird problem where the picture doesn't fully disappear when the slides change. It leaves the picture there, and then it suddenly disappears. Like this:

It's given me nothing but trouble and I can't seem to track it down. Any suggestions?

解决方案

After prettifying jquery.themepunch.plugins.min.js and stepping through using Chrome's web inspector, I was able to track down the cause of the issue.

It is being used by a call to jquery's each function on an undefined object.

I wouldn't recommend fixing or altering code that you don't own, but for now you can fix the bug by just putting in an undefined check on the cssAnimationRemove function:

Prettified, the original function looks like this:

a.fn.cssAnimationRemove = function () {
    var b = this;
    var c = b.data("cssAnimations");
    var d = b.data("identity");
    a.each(c, function(a, b) {
        c[a] = b.splice(d + 1, 1);
    });
    b.data("cssAnimations", c);
};

The modified prettified version just needs an undefined check inserted. It will look something like this:

a.fn.cssAnimationRemove = function () {
    var b = this;
    var c = b.data("cssAnimations");
    var d = b.data("identity");
    if (typeof c !== "undefined") {
        a.each(c, function(a, b) {
            c[a] = b.splice(d + 1, 1);
        });
    }
    b.data("cssAnimations", c);
};

We came across the same issue after buying a theme that includes this version of the slider (which I suspect is an older version, as the files on the Revolution Slider website are not the same as the files we have locally).

这篇关于jQuery Uncaught TypeError with Theme Punch Revolution Slider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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