jqDnR plugin doesn't work with jQuery 1.4

2019-05-04 18:02发布

问题:

I am using jqModal plugin which relies on jqDnR for drag and resize support. After I upgraded jQuery to 1.4, modal boxes stopped responding to "drag" event. Does anyone know why this is happening?

Thanks..

回答1:

Using the version downloaded directly from the author's website (here), on lines

19, character 38

and

27, character 23.

Replace

$()

with

$(document)

That's how I got jqDnR to work with 1.4



回答2:

see the jQuery 1.4 release announcement - Backwards-Incompatible Changes.

We’ve also written a plugin that provides backwards compatibility with every potentially-breaking change that we’ve made in 1.4. Feel free to download and include this plugin, after you’ve included 1.4, if you have any issues upgrading to 1.4.

How to use the plugin:

<script src="http://code.jquery.com/jquery.js"></script>
<script src="http://code.jquery.com/jquery.compat-1.3.js"></script>

include it, or wait for new, 1.4 compatible version of plugin you're using.



回答3:

I was using the jqDnR, jqModal and jQuery for several months and had issues with dragging failing in Safari/Chrome or getting stuck in Firefox. I recommend switching to JQuery UI Draggable...

http://jqueryui.com/demos/draggable/

I think many of the features that were originally in jqDnR/jqModal have been moved to ui-draggable. The switch wasn't too tough. The only drawback (which is also in jqDnR) is when using an iframe in the draggable container. If the mouse moves too fast into the area of the iframe from the drag handle (or draggable area containing the iframe), the iframe appears to pick up the mouse action and the drag gets hung until you re-enter the draggable area. A bit of a hack is required for that...

Trouble Using JQuery UI.Resizable() and UI.Draggable() with an iFrame

After putting the hack above, performance is better.