Splitter.js不适用于新版本的jQuery [英] Splitter.js won't work with new versions of jQuery

查看:126
本文介绍了Splitter.js不适用于新版本的jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I'm using Splitter.js in a project.

该代码来自 http://methvin.com/splitter/ 特定的JS位于 http://methvin.com/splitter/splitter.js

The code is from http://methvin.com/splitter/ The specific JS is at http://methvin.com/splitter/splitter.js

使用jQuery v1.5.2时,代码可以正常工作.

When using jQuery v1.5.2, the code works correctly.

当我转到jQuery v1.7.2时,代码失败,并给出太多的递归"错误. 当我使用jQuery 1.6.2

When I move to jQuery v1.7.2, the code fails, and gives a "Too Much recursion" error. This also appears to happen when I use jQuery 1.6.2

有人对此有解决方法吗?

Does anyone have a workaround for this?

我确实在https://bungeni-exist.googlecode.com/svn-history/r188/xq-framework/trunk/db/framework/assets/bungeni/scripts/splitter.js,但这似乎无法解决问题.

I did find an (updated?) version of splitter.js at https://bungeni-exist.googlecode.com/svn-history/r188/xq-framework/trunk/db/framework/assets/bungeni/scripts/splitter.js but this doesn't appear to solve the problem.

任何建议将不胜感激.

推荐答案

我遇到了同样的问题.在splitter.js文件中浏览了一会儿之后,我遇到了这段代码:

I was experiencing this same issue. After looking around in the splitter.js file for a while, I came across this section of code:

// Resize event handler; triggered immediately to set initial position
    splitter.bind("resize", function(e, size){          
        // Custom events bubble in jQuery 1.3; don't get into a Yo Dawg
        if ( e.target != this ) return;

        ......

    }).trigger("resize" , [initPos]);

"yo dawg"引用是死掉的赠品:)

The "yo dawg" reference was the dead giveaway :)

可以肯定的是,在Chrome中对其进行调试后,此特定事件处理函数中的递归过多.编写它的开发人员试图解决此问题,但是由于某种原因,较新版本的JQuery库无法按预期工作,并且从未满足转义条件.据我所知,这段特定的代码仅在页面加载期间用于设置拆分器的初始位置.我发现除堆栈溢出外,拆分器仍然可用,并且我注意到该问题的唯一原因是因为初始化拆分器后我的javascript代码未运行.如果有时间,请查看您是否可以找出为什么这部分代码无法正常工作并发布修复程序.如果您赶时间并且不介意使用胶带,请尝试在调用.splitter()函数的代码行周围进行尝试. Chrome 19和IE 9都可以正常工作.

Sure enough, after debugging it in Chrome, there is excessive recursion in this particular event handler function. The developer who wrote it attempted to resolve the issue, but for some reason the newer version of the JQuery library does not work as expected, and the escape condition is never met. From what I can tell, this particular piece of code is only used during page load to set the initial position of the splitter. I found that the splitter was still usable aside from the stack overflow, and the only reason I noticed the problem was because my javascript code after initializing the splitter wasn't running. If you have time, see if you can find out why this part of the code isn't working and post a fix. If you're in a hurry and don't mind duct-tape, put a try catch around the line of code where you call the .splitter() function. It seems to work fine in both Chrome 19 and IE 9.

这篇关于Splitter.js不适用于新版本的jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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