jquery-resizable icon indicating copy to clipboard operation
jquery-resizable copied to clipboard

I have noticed that if jquery ui is loaded then jquery resizable does not work.

Open handysolver opened this issue 8 years ago • 7 comments

handysolver avatar Sep 29 '17 10:09 handysolver

Yeah I ran into this problem as well and kind of blocking the use of this library

Sulstice avatar Oct 13 '17 15:10 Sulstice

I'm guessing it is because jQueryUI also has a $().resizable() method. See also #17.

Since jQueryUI is orders of magnitude more popular, renaming the function this plugin creates on $.fn or at least having some way of cooperating with and not conflicting with jQueryUI would be useful.

pmorch avatar Dec 21 '17 16:12 pmorch

Definitely true... but if you're using jquery-ui you certainly don't need this plugin. It was created to avoid for the use case where a larger framework isn't available.

RickStrahl avatar Jan 09 '18 13:01 RickStrahl

How do you use with jquery ui?

thiscafer avatar Feb 11 '19 10:02 thiscafer

@thiscafer you can rename the function to make it work alongside jquery ui.

dominicgan avatar Mar 19 '19 09:03 dominicgan

Actually there is use of this method alongside jquery-ui, it allows me to specify and style an custom divider handle. I renamed it for myself as resizer but I would prefer to use the original npm package.

taleteller avatar Jul 29 '19 17:07 taleteller

Revisiting this after some thought I think it would be pretty easy to add a .resizableSafe() alias that would allow any components that use jQuery.resizable() to get a reliable reference to the plugin.

If made some changes for 0.35+ that do:

if ($.fn.resizableSafe)
        return;

$.fn.resizableSafe = function fnResizable(options) {
     ... main implementation
}

if (!$.fn.resizable)
   $.fn.resizable = $.fn.resizableSafe;

You should then be able to replace any reference to .resizable() with .resizableSafe() to co-exist with jquery.ui or any other component that also use .resizable():

<script>    
    $(".box").resizableSafe({
        handleSelector: "> .win-size-grip",
        onDragStart: function (e, $el, opt) {
            $el.css("cursor", "nwse-resize");
        },
        onDragStop: function (e, $el, opt) {
            $el.css("cursor", "");
        }
    });        
</script>

RickStrahl avatar Nov 19 '19 07:11 RickStrahl