Adjust the jQuery resizable handlers on the fly

I am encountering an issue when attempting to change the handler on a resizable element.

Initially, I used :

$(line)
    .draggable({containment:"parent"})
        .resizable({
            containment:"parent",
            handles: "e, w"
        });

Now, I am trying to switch the handler from "e, w" to "n, s", but when I execute:

$(line)
.resizable({
    containment:"parent",
    handles: "n, s"
});

The handlers do not update. What could be causing this issue?

Thank you for your help.

Answer №1

Currently, the option setter for this particular option is not available. Check out this bug link for more information. Once the issue is resolved, you can utilize the resizable method's setOption to set the handles option:

$(element).resizable("option", "handles", "n, s");

In the meantime, follow these steps:

var options = {
    containment: "parent",
    handles: "e, w"
};
$(element)
.draggable({containment:"parent"})
.resizable(options);

When you need to change the handles, do as follows:

options.handles = "n, s";
$(element).resizable("destroy");
$(element).resizable(options);

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Can anyone provide guidance on how to simulate a click on a JavaScript action for an iPhone?

I am attempting to trigger a click on a "javascript:void(0)" link so that I can retrieve HTML data within the script. Can someone advise me on how to achieve this without using illegal APIs like UITouchEvent, as I only work with NSUrl? Thank you in advan ...

What are the steps for implementing a equirectangular image in WebXR with three.js?

Currently, I am developing a web application with Three.js that requires the use of equirectangular images for panoramic tours. My goal is to incorporate a feature that allows users to switch between normal mode and VR mode similar to React360 and AFrame. ...

The AJAX request to the GitHub OAuth API using jQuery encountered an unknown issue and returned an unexpected error

Let me start by sharing the following code snippet: var requestAuthUri = 'https://github.com/login/oauth/access_token'; var ajaxArgs = { type : 'POST', url : requestAuthUri, headers : { &ap ...

The error message "TypeError: Cannot set property 'href' of undefined" occurred at angular.js line 12520 when trying to set $window.location.href

Has anyone tried using a directive function to redirect when clicking with ng-click? Here is the HTML code: <a ng-click="navbarlinksCtrl.clickedfr()" ng-class="{active: clickedfr()}">FR</a><br> <a ng-click="navbarlinksCtrl.clickeden( ...

Updating an HTML input field property with JavaScript is not reflecting the changes

I am currently working on a form with two fields: stationery type and stationery request quantity. The stationery request quantity field only accepts numerical input. The minimum quantity that can be entered in this field depends on the value selected in t ...

Issues with sending parameters in JQuery Ajax POST request

Currently, I am delving into Ajax and encountering some issues with sending requests from the client side. I have a jsp file located at "/web" on my local server to manage requests. Though unsure if this is the best approach or if it should be handled by ...

Explore the comparison feature with jQuery's combobox

I am attempting to compare values from an array with values in a combobox using jQuery, but I am encountering difficulties. My array is structured like this: (value 1, value 2,...) names separated by commas (Example: john smith, peter pan). On the other h ...

Obtain the bootstrap CSS file

In all my various projects, I have been utilizing Bootstrap 3 and now I am interested in incorporating Bootstrap 4 cards into my work. However, I am struggling to locate the cards in a css format rather than the scss format. I personally don't think ...

Is there a way to specifically select the input field that the user has typed into using a selector?

Is it possible to use javascript/jquery to specifically target the input field that a user has just typed in? ...

What steps should I take to ensure the height of this navigation bar is correct?

I'm attempting to ensure that this div displays the correct height (without manually specifying a fixed number like 75px). Here's how I want it to appear: ------------------------------------------ | something | something else | --- ...

Is there a way to prevent my cell from resizing during the initiation of a jQuery animate effect?

After coding a 2x2 DIV table, I encountered an issue where the left side of the cell appears when hovering over the right cell. However, the left cell is hidden when the mouse leaves the right cell, utilizing a jQuery animate effect. I'm facing a pro ...

Incorporate a hanging indent within the text enclosed by the <li> element

(revised multiple times to enhance clarity) Disclaimer: I did not create the HTML code. Below is the structure of the HTML (please note that the links and text following them are on the same line): <li> <strong>Heading of section</str ...

Is it possible in ReactJS to return JSX from a callback function?

After spending some time working with react, I encountered a basic issue that has me stumped. In the Login component, I am submitting a form and if it returns an error, I want to render a snackbar message. handleSubmit = (event) => { event.preven ...

Should we make it a routine to include shared sass variables in each vue component for better practice?

Within my Vue application, there are numerous components that rely on shared variables like colors. I'm considering having each component import a global "variables.scss" file. Would this approach have any adverse effects? ...

Populate Select2 with data after making an AJAX call for insertion

Currently, I am implementing the Select2 plugin with AJAX functionality using the code snippet below: $(".select2-ajax").select2({ placeholder: "Search user", minimumInputLength: 1, ajax: { url: $('#url-search-clie ...

Looking for a way to connect a background image in Vue CLI?

When running the code below, I encounter an issue. The code runs properly but the images are not displaying and instead showing the URL as unknown. How can I fix this problem? The images definitely exist. <template> <div class="slider">< ...

Trouble with CSS matching pattern - not functioning as expected

I am facing a requirement to customize the colors of ribbon styles instead of using the default ones. After researching pattern matching in CSS, I attempted the following code, but it did not work: This is my original CSS: .ms-cui-cg-**tl** .ms-cui-ct-f ...

Jasmine examination fails to progress to the subsequent segment of the promise

I want to test a specific function: function initializeView() { var deferred = $q.defer(); if(this.momentArray) { core.listMoments(constants.BEST_MOMENT_PREFIX, '').then(function(moments) { //Ommit ...

Adjusting the height of content in Angular Material 2 md-tab

I've recently started working with angular material and I'm facing an issue while trying to implement md-tab into my application. The problem is that I can't seem to style my tab content to take up the remaining height of the screen. Could s ...

The jQuery attr() method is universally compatible across platforms and stands independent

I have a jQuery statement that is currently working for me, but I am unsure if it is cross-platform independent. Can anyone confirm? $("input[name='confirmed']").attr("checked",false); It is functioning correctly on the latest version of Firefo ...