Input Range Multiple CSS Jquery Javascript Scss Sass
How do I make an input range multiple css jquery javascript scss sass?
What is a input range multiple css jquery javascript scss sass? How do you make a input range multiple css jquery javascript scss sass? This script and codes were developed by Paulo Sérgio on 19 November 2022, Saturday.
Input Range Multiple CSS Jquery Javascript Scss Sass - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Input Range Multiple CSS Jquery Javascript Scss Sass</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="range-container">
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Input Range Multiple CSS Jquery Javascript Scss Sass - Script Codes CSS Codes
input[type="range"][multiple] { display: block; height: 30px; margin: 0; pointer-events: none; width: 90%;
}
input[type="range"][multiple] + input[type="range"][multiple] { margin-top: -30px;
}
input[type="range"]::-webkit-slider-thumb { pointer-events: all;
}
Input Range Multiple CSS Jquery Javascript Scss Sass - Script Codes JS Codes
var container = $("#range-container");
var values = [20 , 40 , 60 , 80 ,100]
var previus = [0,0,0,0,0];
var itemWidth = 30;
//append inputs
values.forEach(function(value, i){ var input = $('<input type="range" multiple></input>').clone(); input.attr("max" , 100) input.attr("id" , "range" + i); input.attr( "min" , 0); input.attr( "step" , 0.01); input.val(value) container.append(input); $(window).resize(function(){ //$("#range" + i).change(); input.change(); })
})
/*$("input").change(function(){ console.log($(this).val())
})*/
function getDirection(index , value){ if(previus[index] > value){ previus[index] = value; return 'left'; } previus[index] = value; return 'right';
}
function checkIfHasMove(position , index, width){ var length = (values.length - 1) - index; if(position > width - itemWidth*length){ console.log('dont has move') return false; } return true;
}
$('input').each(function(){ //console.log($(this).attr('id')) var id = $(this).attr('id'); console.log(id) $(document).on('input change', "#" + id , function() { var value = $(this).val(); var id = $(this).attr('id').split("range")[1]; var width = $(this).width(); var x = (width/100) * value; var direction = getDirection(id, value); if(!checkIfHasMove(x , id, width)){ var length = (values.length - 1) - id; //var itemWidth = (30); //var nValue = ( (width - (width/100)*length) )/ (width/100); var nValue = (width - (itemWidth*length)) / (width/100); console.log('checkIfHasMove' , nValue) $(this).val(nValue) } //console.log('direction' , direction) if(direction == "right"){ sinbling = $("#range" + (++id)); } else { sinbling = $("#range" + (--id)); } sValue = sinbling.val(); sX = sValue * (width/100); //console.log('x value' , x) //console.log('sX' , sX) if(direction == 'right' && x > sX - itemWidth){ var p = x + itemWidth; //new position var nValue = p / (width/100) //new value //console.log(nValue) sinbling.val(nValue) sinbling.change(); } else if(x < sX + itemWidth && direction == 'left'){ //console.log('collision') var p = x - itemWidth; //new position var nValue = p / (width/100) //new value //console.log(nValue) sinbling.val(nValue) sinbling.change(); } });
})
Developer | Paulo Sérgio |
Username | paulo101977 |
Uploaded | November 19, 2022 |
Rating | 3 |
Size | 2,880 Kb |
Views | 16,192 |
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 |
Tributo a Renato Russo | 5,611 Kb |
SunRay Css | 2,200 Kb |
Spinner Loader SVG Pure Css Radius Loader | 2,148 Kb |
Game of Life | 6,047 Kb |
Quote Api | 3,963 Kb |
Menu Navigation Items | 5,500 Kb |
D3js SVG Clip Path | 5,740 Kb |
Spinner pure CSS loader radius | 2,236 Kb |
Project Singapoure | 4,037 Kb |
WeatherMap | 13,360 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 |
Getting Started | Viblast | 1,500 Kb |
CSS Hover Effects | Alen | 3,613 Kb |
To Do List with Delete | Mattlbrody | 2,068 Kb |
Blank Starter | Mhartington | 2,171 Kb |
A Pen by Anoop | Anoopjohn | 330,760 Kb |
Funny menu | AxeLVaisper | 4,671 Kb |
Slide out Menu | Rbiggs | 4,936 Kb |
A cube | KyleDavidE | 18,627 Kb |
A Pen by Jess | Jessamyne | 5,100 Kb |
Realistic Buttons | Stoypenny | 2,248 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!