The resizing function on the droppable element is malfunctioning on Mozilla browsers

I've been working on making one div both droppable and resizable. Surprisingly, everything is functioning perfectly in Chrome but not in Firefox.

If you'd like to see the issue for yourself, here is my jsFiddle demo that you can open in Firefox:
MY DEMO

Let me share a snippet of my code:

// main drop function for work area
$('#img-drop-container').droppable({
  accept: '.img-drop',
  drop: function(event, ui) {
    var $clone = ui.helper.clone();
    if (!$clone.is('.inside-drop-zone')) {
      $(this).append($clone.addClass('inside-drop-zone').draggable({
        containment: '#img-drop-container',
        stack: '.inside-drop-zone',
        zIndex: 100,
        cursor: 'pointer'
      }));
      $clone.removeClass('img-drop');

      // resize image
      //   $('.inside-drop-zone').resizable({
      //   aspectRatio: true,
      //   handles: 'ne, se, sw, nw'
      //   });
    }
  }
});

//clone the draggable items
$('li .img-drop').draggable({
  helper: 'clone',
  cursor: 'pointer',
});
ul {
    list-style:none;
}
#img-drop-container {
    background-color:#d8d8d8;
    border: 1px solid #9C9898;
    height:557px;
    width:99.9%;
}
.img-drop {
    height: 120px;
    width: auto;
}
#trash {
    float:left;
    margin-left:20px;
    margin-top:20px;
}
#trash {
    width:140px;
    height:140px;
    background-repeat: no-repeat;
    background-position:center center;
    z-index:2;
}
img {
    width:auto;
    height:auto;
}
.store-thumb {
    height: 50px;
    width: 50px;
}
#imgbg {
    float: right;
    left: -2%;
    position: relative;
    top: 4%;
}
.column {
    margin-top: -21%;
    margin-left:55%;
}
.resizable {
    width: 100px;
    border: 1px solid #bb0000;
}
.resizable img {
    width: 100%;
}
.ui-resizable-handle {
    background: #f5dc58;
    border: 1px solid #FFF;
    width: 9px;
    height: 9px;
    z-index: 2;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<ul id="carousel" class="elastislide-list">
  <li>
    <div class="img-drop">
      <div style='resize: horizontal; height:20px; width: 100px; overflow: auto; border: solid gray 1px;float:left;  background-color: green;'></div>
    </div>
  </li>
</ul>
<div id="img-drop-container"></div>

Answer №1

Fiddle: http://jsfiddle.net/c38WX/40/

HTML: there is only a single div inside li

<div class="img-drop" style='height:20px; width: 100px; overflow: hidden; border: solid gray 1px;float:left;  background-color: green;'></div>

JQ:

include resizable widget functionality

$('li .img-drop').draggable({
        helper: 'clone', 
       cursor: 'pointer',
    }).resizable({ 
        handles: "e" ,
        autoHide: true
    });

Answer №2

Check out this interactive Fiddle that showcases a resizing feature, although the exact functionality is not completely clear.

JSFiddle Demo

Instead of relying on resize:horizontal, I opted for jQuery UI's resizable function (similar to your attempt) to manage the resizing aspect. Using handles: 'e, w' ensures the resizing is limited to horizontal movements only.

// Enable image resizing
$('.resize_box').resizable({
    handles: 'e, w'
});

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

Unexpected issue with sliding menu toggle implementation

I have been struggling to make a menu slide to the left when a button is clicked, and then slide back to its original position when the same button is clicked again. Although I have been using the toggle method, it doesn't seem to be working for me. I ...

Creating a custom Vue.js component for specific table cells within a table row - here's how!

My challenge is having related and neighboring table columns grouped within the same component in Vue.js. However, I'm facing a limitation with the template system where only one tag can be directly placed inside <template>. Typically, this wrap ...

Is it feasible to decrease the lateral margins of Bootstrap's container without the need for custom CSS? If so, what is the method?

My web page includes several screenshots to illustrate the issue I am facing. One of my challenges is the scroll bar below the table, which I find displeasing. In an attempt to resolve this, I decided to adjust the lateral margins slightly. Here's a s ...

Unexpected element layout issues

Attempting to create a basic website that utilizes the flickr api, retrieves photos and details, and displays them using bootstrap. However, there seems to be an issue that I am unsure how to resolve. Currently, my code is functioning like so: https://i.s ...

Define a universal URL within JavaScript for use across the program

When working with an ASP.NET MVC application, we often find ourselves calling web service and web API methods from JavaScript files. However, a common issue that arises is the need to update the url in multiple .js files whenever it changes. Is there a me ...

Is there a more efficient way to consolidate multiple functions like this into one cohesive function instead of having to define each one separately?

After attempting to implement a loop without success, I also considered using regex but that did not work either. The code in question is part of a larger project that involves dynamically adding and deleting fields using jQuery. The classes and ids used f ...

Is it possible to utilize AJAXToolKit and Jquery on a single webpage?

Is it possible to utilize both AJAXToolKit and jQuery on a single page? For example, let's say we have ScriptManager in the same page along with including ...

What is the best way to display a list of database records using Django?

Is there anyone who can assist me with this? I have a list of 60 records from a Django database in my HTML file. My goal is to display that list in a table with 6 columns and 10 rows. However, when using the {% for %} command in the HTML file, the list app ...

What is causing my anchor tags not to reflow properly?

I've been working on my new website and I'm facing a challenge that I just can't seem to solve. Here's the link: When I resize my browser to "mobile width", making it narrower than the row of oval "Tags" below my site menu, I want the ...

Result being returned from XMLHTTPRequest function

I've been experimenting with an XMLHttpRequest and managed to get the basic code functioning properly. However, I'm struggling to create a function that will return a boolean variable indicating whether it has worked or not: var xhr = new XMLHtt ...

What steps can I take to troubleshoot the "Element type is invalid" error in my React application?

I am currently restructuring my initial code for better organization. Click here to view the code on CodeSandbox. However, I'm facing issues with integrating child components into my code. For example, in this instance, I showcase how I import a chi ...

The technique for handling intricate calls in node.js

My goal is to create a social community where users are rewarded for receiving upvotes or shares on their answers. Additionally, I want to send notifications to users whenever their answers receive some interaction. The process flow is detailed in the com ...

Can someone provide a method to access the namespace of an Angular controller when utilizing the "Controller As" format?

Imagine you have an AngularJS ngController directive set up like this: <div ng-controller="SomeCtrl as herpderp">…</div> Is there a way to extract the namespace ("herpderp") from within the SomeCtrl controller itself? This could be useful f ...

Tips for verifying conditional input fields in a React component?

As a beginner in React, I attempted to create a SignIn form component that dynamically changes its layout based on a boolean prop toggled between Login and Signup options. In the signup version, there is an additional text field labeled Confirm password, w ...

What is the best way to transfer a user-generated PNG file to my backend server?

I'm in the process of developing a website that enables users to generate personalized graphics and easily download them directly from the platform. My approach involves allowing users to customize an svg using a javascript-powered form, which is the ...

The measure of the leaflet map's vertical dimension in a Shiny module application

I'm facing an issue while trying to incorporate my small app as a module within my larger app. Everything seems to be working fine except for the height of the leaflet map. In the standalone app, I had: ui <- fluidPage( tags$style(type = "te ...

Trouble arises when attempting AJAX call to PHP file resulting in failed MySQL execution accompanied by errors

Having some trouble identifying the issue here. It seems quite simple, but I'll highlight it here anyway. On a basic website, I have a form for user registration where I'm using AJAX to send data to register.php. The form and AJAX code are as fol ...

The process of integrating Tailwind elements into NextJs version 13

Can anyone help me integrate Tailwind elements into my NextJs project using JavaScript instead of TypeScript? I tried following the documentation, but the navbar component's expand button doesn't work. It seems like all components are having some ...

Two separate occurrences hold identical values

I'm encountering an issue where instantiating a class two times results in the second instance retaining parameters from the first instance. Here's a simple example: var Test = function() {}; Test.prototype = { bonjour: null, hello: { h ...

Processing of an array received via AJAX and passed to a PHP script, inside a separate function in a different file

I have a JavaScript array that I am sending via AJAX to a PHP file named aux.php. What I want is for this array to be visible and manipulable within a function inside a class in another PHP file called payments.php. I've provided all the code so they ...