Error: Dragdealer failing to initialize

html

<div class="modal fade" id="exampleModal1" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div id="demo-simple-slider" class="dragdealer">
        <div class="handle red-bar">
            <p><input id="values" onchange="alert();" type="text"></p>
        </div>
    </div>
</div>

jquery

$( "#exampleModal1" ).on('shown', function(){
    //Dragdealer
    //Product condition
    var main_width = $('#demo-simple-slider').outerWidth();

    new Dragdealer('demo-simple-slider', {
        animationCallback: function(x, y) {
            dragged_handle();
            $('#demo-simple-slider #values').val((x * 7).toFixed(1));
            var x = $('#demo-simple-slider #values').val();
        },

    });

    //Function to set Handle position
    function dragged_handle(){
        var left_off_container = $('#demo-simple-slider').offset().left;
        var left_off = $('#demo-simple-slider .handle').offset().left;
        var width_circle = ((left_off - left_off_container) + 10);
        $('#demo-simple-slider .sado-div').width(width_circle);
    }
});

The previous use of this plugin was successful. Reusing the same code as shown above, I encountered an issue where the handle does not move. Despite no errors in the console, I am unable to identify the root cause of the problem.

Answer №1

Great job, you're on the right path! Just make a small adjustment to your Bootstrap modal shown handler from

$( "#exampleModal1" ).on('shown', function(){ ... })
to
$( "#exampleModal1" ).on('shown.bs.modal', function(){ ... })
. For more information, refer to Bootstrap Modal Events.

Don't forget to wrap the handler in

$(document).ready(function(){ ... })
.

Lastly, ensure that you have included all the necessary stylesheets and scripts for it to work correctly. Hope this clarifies things!

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

Creating a Div element to occupy an entire row is a simple task that can be achieved

Seeking a solution to automatically generate a DIV when our products do not fill up the entire row, using the MixItUp jQuery filter and sort plugin. Is there a JavaScript code that can detect the empty space in a row and create the necessary div to mainta ...

Utilizing AJAX to fetch and retrieve a JSON array

Check out the javascript code below: var formSerializedData = $('form#registration-form').serialize(); $.post( '<?php echo $this->url('/register', 'do_register')?>', function(response) { alert(response); } ...

Unable to access the 'fn' property of undefined in Handlebars causing a TypeError

I encountered an issue with my custom handlebars helper. When I fail to define values for the parameters, I receive the following error message. module.exports = function(src, color, classatr, options) { if (typeof src === 'undefined') src ...

Attempting to categorize JSON object elements into separate arrays dynamically depending on their values

Here's the JSON data I'm currently working with: ?$where=camis%20=%2230112340%22 I plan to dynamically generate queries using different datasets, so the information will vary. My main objective is to categorize elements within this array into ...

Looping through an array of items and computing the mean value

Given the current data structure, my goal is to calculate the average value for each column across all items in the contenders object. The next step is to convert this information into an array of arrays. Each subarray should consist of two values: the rou ...

Transform your Angular Framework Application into a desktop application with the power of Electron

Project Description: I currently have a fully functional front-end angularjs application that is connected to a back-end Java application deployed on Tomcat, running on a different port (8443). Up until now, I have been accessing the application through a ...

Prevent unauthorized access to my website's code

There are multiple ways for visitors to view the source code of a web page, such as right-clicking and selecting 'view source', or using keyboard shortcuts like ctrl+u, ctr+shft+i, ctrl+shft+j, or f12. I want to give credit where it's due - ...

Processing Incoming HTTP Requests in AngularJS Server Backend

Recently diving into AngularJS for my web development projects has been a game-changer. However, being a newbie in the realm of web programming, I've been struggling to find a concise answer to my current query. The burning question on my mind pertain ...

Using jQuery causes a textarea to post NULL values

I have a form that stores data in a database, and I'm using jQuery to show either success or fail messages before clearing the form. The issue is with my textarea - it posts a NULL value when using jQuery but works fine without it. All other inputs wo ...

Interact with the DOM dynamically for every Ajax response without causing the user interface to freeze

I conduct a for loop for every request that is sent.. for (let k = 0; k <= 1000; k++) { $.ajax({ url: `127.0.0.1/index?value=${k}`, method: `get`, beforeSend: function() { // any action.. }, succes ...

React.js: Issue with triggering handleSubmit or onClick when rendered on the server side is not being recognized

Encountering an issue with server-side rendering and triggering a handleSubmit event. Here is the code snippet: index.js: module.exports = require('./app/server'); app/server/index.js: 'use strict'; var env = process.env.NODE_ENV | ...

Obtain all subelements from the entity

In my Vue project, I am attempting to collect and POST some values to the server. However, I am finding the current implementation to be somewhat frustrating. Within a Vue method, I have a function that POSTs the collected values from the original object: ...

Retrieving chosen items from NextUI-Table

I am completely new to JavaScript and NextUI. My usual work involves C# and DotNET. I have a requirement to create a table with selectable items, and when a button is clicked, all the selected items should be passed to a function on the server that accepts ...

I wish to adjust the font size as well as resize the table elements simultaneously

Adjusting the height and width of the table should automatically adjust the font size as well. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI Resizable - Default functiona ...

What is the best way to incorporate padding into an Angular mat tooltip?

I've been attempting to enhance the appearance of the tooltip dialog window by adding padding. While adjusting the width and background color was successful, I'm encountering difficulties when it comes to styling the padding: https://i.sstatic.ne ...

Retrieve stock data using YQL and JQuery within an ASP.NET application

My ASP.NET project involves retrieving stock information using a YQL query. I am utilizing jQuery to make a JSON call in order to fetch the data. The problem arises when clicking the 'GetData' button on the page, as it simply refreshes the page w ...

Is there a more efficient way to optimize my coding for this Cellular Automata project?

As a beginner in programming, I wanted to delve into the world of cellular automata and decided to create my own using JavaScript. The project involves a simple binary (black and white) 2D CA where each cell updates its color based on the colors of its 8 ...

Ways to verify browser rollover support (as some mobile devices lack a cursor)

I am currently exploring options to determine if rollover events are supported for navigation. If not, I plan to switch to click events. I have reviewed jQuery.Support and Modernizr but haven't come across anything that directly addresses my issue. T ...

Is there a way to adjust the font size of a vue-good-table within a vue.js project?

I am facing an issue in Vue.js where the content of a page gets "cut off" on the right side when trying to print it. I'm wondering if I should use a function to solve this problem? <vue-good-table :columns="columns" :rows="rows" ...

What is the best way to manage external redirects for a React app on the client side?

I am creating a web application that utilizes the True Layer open banking API. The frontend is built using React with react router, and the backend is created with Express and Node.js. Currently, I am serving the static files using the react build script: ...