Input with Draggable Values
How do I make an input with draggable values?
Works as a normal text input, but can also be dragged to increment value.. What is a input with draggable values? How do you make a input with draggable values? This script and codes were developed by Cmalven on 29 January 2023, Sunday.
Input with Draggable Values - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Input with Draggable Values</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="input-wrapper"> <input type="text" placeholder="0.00" value="100.00"/> <div class="input-cover"></div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Input with Draggable Values - Script Codes CSS Codes
body { padding: 50px;
}
.input-wrapper { position: relative;
}
.input-cover { position: absolute; top: 0; right: 0; bottom: 0; left: 0; cursor: ew-resize;
}
input { width: 100%; padding: 8px 0; font-size: 14px; border: none; border-bottom: 1px dashed #ccc;
}
Input with Draggable Values - Script Codes JS Codes
(function() { var APP; APP = { dragging: false, startingX: null, currentX: 0, increment: 0.1, originalVal: null, didDrag: null, $el: $('.input-cover'), isOverInput: false, down: function(evt) { APP.dragging = true; APP.startingX = evt.pageX; return APP.originalVal = Number(APP.$el.val()); }, up: function(evt) { if (!(APP.didDrag || !APP.isOverInput)) { $('input').focus(); } APP.dragging = false; APP.startingX = null; return APP.didDrag = false; }, move: function(evt) { var dragDistance, newVal; if (!APP.dragging) { return; } APP.didDrag = true; APP.currentX = evt.pageX; dragDistance = APP.currentX - APP.startingX; newVal = APP.originalVal + (APP.increment * dragDistance); newVal = Math.round(newVal * 100) / 100; return $('input').val(newVal); } }; APP.$el.on('mousedown', APP.down).on('mouseenter', function() { return APP.isOverInput = true; }).on('mouseleave', function() { return APP.isOverInput = false; }); $(window).on('mousemove', APP.move).on('mouseup', APP.up);
}).call(this);
![Input with Draggable Values - Script Codes](http://shots.codepen.io/cmalven/pen/PwJYMo-512.jpg)
Developer | Cmalven |
Username | cmalven |
Uploaded | January 29, 2023 |
Rating | 3 |
Size | 3,061 Kb |
Views | 4,048 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Chi Coast | 12,923 Kb |
Responsive Device Morph | 7,940 Kb |
THREE.js Globe imported from OBJ | 4,498 Kb |
Type Pathfitting | 6,112 Kb |
TweenMax Smoke | 2,994 Kb |
One Distortion | 4,981 Kb |
Let it Snow | 3,149 Kb |
Three.js Playground | 3,712 Kb |
Layer Tennis Header | 2,930 Kb |
Three.js Node Cloud | 5,315 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Pure CSS Dial | Lukewatts | 3,018 Kb |
Filtering with shuffle.js | Deyand | 2,712 Kb |
Wikipedia Viewer | Thalpha | 4,426 Kb |
Wip elementary os navbar | Nickcolley | 2,993 Kb |
Octopus Bar iPad App Interactions | Davidkpiano | 6,735 Kb |
Scifi-style Interative Form | Aaronchuo | 4,566 Kb |
RWD Conversion Practice | Jxqr97 | 2,743 Kb |
Mobile Sub Menu Concept | Berdejitendra | 2,790 Kb |
Fading Navigation Bar | J-w-v | 2,805 Kb |
Personal Website Redesign v2.0 | DevItWithDavid | 5,168 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!