Tips on preventing a div from being draggable within another div that is draggable

I have a plugin called Owl-Carousel that allows for sliding functionality.

It automatically slides, but you can also manually slide it by dragging the slides.

I want to insert some divs inside the slides; however, if the drag starts from that div, I don't want it to cause the slide to move. The div is clickable, so I don't want users accidentally scrolling it when they intend to click on it.

Here's an example:

<div class="owl-carousel">
    <figure>
        <div class="foo">Content...</div>
        <img src="blablabla.jpg">
    </figure>
</div>

I would like the foo div to move with the rest of the content, without enabling scroll through clicking and dragging specifically on this div. However, I still want users to be able to scroll by clicking elsewhere and dragging.

Is there a solution for this?

In CSS, there is the option of pointer-events: none, but I need the div to remain clickable.

This solution could involve HTML, CSS, JavaScript (jQuery or "vanilla"), or even an option within Owl-Carousel itself.

Answer №1

There is a solution to a similar issue:

How to prevent dragging in a specific element (Item) within the "Owl carousel" using jQuery

Give it a try, it might be useful.

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

Spans are not creating hyperlinks within anchors

Check out the full code. Here's the relevant code snippet: <a href='http://app.bithumor.co/report_post?id=568'><span class='report_icon'></span></a> Using CSS: <style> .report_icon { width: 60p ...

I'm trying to find the location of the server.js file in Node

Currently, I am diving into a book that delves into the integration of nodejs and backbonejs. It covers the foundational aspects that serve as the building blocks for understanding. (...) To kick things off, execute the command 'npm install express& ...

What is the best way to send progress updates from PHP to the webpage following a user's button press?

As a user clicks on a series of buttons on the page, it triggers a PHP script through jQuery utilizing the .ajax() method. Currently, I am appending a concatenated string dump of "progress updates" to a status placeholder DIV using the success: function(da ...

Tips for sending an XML string in an ajax request to an MVC controller?

I have a challenge with posting an XML string to an MVC controller using an Ajax call. The MVC controller only accepts a string parameter, and I'm struggling to successfully process the request. How can I effectively send the XML string to the Control ...

Contenteditable feature dynamically styling text upon input

Is it possible to prevent CSS properties like text-transform from affecting text entered via contenteditable? On my webpage, "CERTIFICATE PROGRAM" is shown in uppercase due to text-transform settings. However, the original input was: Certificate Program. ...

Is there a way to stop the top nav from covering the first element of the side-nav in specific situations?

I'm grappling with the issue of how to prevent the side-nav from obscuring the top element in the vanilla Bootstrap 4 example provided below. Any tips? (Problem resolved - check below for solution) This problem is occurring not only on my website bu ...

Dealing with currency symbols in Datatables and linking external sources

I'm having trouble linking an external link to the "customer_id" field. The link should look like this: /edit-customer.php?customer_id=$customer_id (which is a link to the original customer id). I am creating a detailed page with most of the informati ...

"Encountering a Dojo error where the store is either null or not recognized

I encountered an issue with the function I have defined for the menu item "delete" when right-clicking on any folder in the tree hierarchy to delete a folder. Upon clicking, I received the error message "Store is null or not an object error in dojo" Can s ...

Unable to apply text decoration to a floating element

Why is text-decoration not applying to a span inside a div after floating the span, and how can this be fixed? To see the issue in action, visit: http://jsfiddle.net/wtBDX/2/ div { color: red; text-decoration: line-through; } div span { float: rig ...

Efficiently add an object to the beginning of an array in React/Redux by utilizing the spread

I've been trying to use a redux reducer to add objects to a state array. Everything seems to be working fine, except for one issue. The objects are always added to the end of the array, when I really need them to be placed at the beginning. I've ...

Guide: Building Angular/Bootstrap button checkboxes within a loop

I am in the process of designing a grid (table with ng-repeat) in which each row contains 4 columns of buttons. My goal is to use checkboxes as the buttons, like the Angular/Bootstrap btn-checkbox, so that they can be toggled on and off. I plan to set thei ...

Issues with font face rendering on Android Chrome and Firefox devices

I'm currently encountering an issue with the font face in CSS3. The code I have been using is as follows: @font-face { font-family: James Fajardo; src: url('https://www.twoseven.nl/kurkorganicwines/wp- content/themes/kurk/fonts/James_Fajardo.t ...

Error message: "The variable 'bitmap' is not defined in jQuery/CreateJS $.ajax"

I recently acquired a product designer that uses CreateJS and jQuery. Within the code, there is a function called UrlLoader which wraps an $.ajax call. function UrlLoader(params) { $.ajax({ url: url, type: 'POST' ...

Clearing user's browsing data

I managed to successfully set up a user cookie, but I'm having trouble getting it to be destroyed or terminated when the user logs out. Any assistance on this matter would be highly appreciated! I am new to PHP and still in the learning process. Here ...

Trouble arises when trying to choose the entries spanning all pages within Angular DataTables

I am facing an issue while trying to select checkboxes across all pages. When I change the page, the selected records are not adding to the previously selected ones. It seems to only take the records from the second page. Can anyone provide suggestions on ...

Retrieving plain text content from HTML while preserving both ordered and unordered lists in Node.js

My goal is to extract plain text from HTML code while preserving the numbering from ordered or unordered lists. However, existing libraries like node-html-parser and cheerio do not maintain this information. To clarify, consider the following HTML: < ...

Loop through subarray JSON data using jQuery and AJAX

I am attempting to retrieve data from a JSON array and use jQuery and AJAX to populate a select field. Here is how my JSON data looks: { "regioni": [ { "nome": "Abruzzo", "capoluoghi": ["Chieti", "L'Aquila", "Pescara", "Teramo"], ...

Are external JavaScript files cached in the same manner as images?

Is it possible for a single pagehandler script to be called from the browser cache when navigating between multiple pages that refer to it? ...

What is the best way to handle response once an asynchronous call has been completed?

In my express.js application, I have implemented a "Pay" button on the user interface. When this button is clicked, I need the server to interact with Stripe's checkout API and wait for a response before proceeding (for example, if a card is expired). ...

Attempting to make a gallery image expand when clicked on

Having trouble with image expansion in a gallery when clicking on different images. Currently, the expanding feature only works on the first image in the set. If I click on another image, the first one is the one that expands. <div ng-repeat="album ...