Я сделал ползунок диапазона, но у меня возникла проблема с входом. Я хочу добавить определенное значение c в другом количестве, которое должно увеличивать количество при каждом входе ползунка. Я хочу увеличить сумму на кнопке на 150 долларов США на 2000 долларов США и на 45000 долларов США, когда диапазон ползунка принимает данные? Если есть кто-то, кто мог бы помочь мне сделать это, если бы вы могли, то это было бы очень полезно!
var range = document.getElementById("range");
var val = document.getElementById("value");
var vvv = document.getElementById("vvv");
var saved = document.getElementById("saved");
val.innerHTML = "$" + range.value + "K";
range.oninput = function() {
val.innerHTML = "$" + this.value + "K";
}
html,
body,
div,
span,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
abbr,
address,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
samp,
small,
strong,
sub,
sup,
var,
b,
i,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
body {
line-height: 1;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
nav ul {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
content: none;
}
a {
margin: 0;
padding: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
/* change colours to suit your needs */
ins {
background-color: #ff9;
color: #000;
text-decoration: none;
}
/* change colours to suit your needs */
mark {
background-color: #ff9;
color: #000;
font-style: italic;
font-weight: bold;
}
del {
text-decoration: line-through;
}
abbr[title],
dfn[title] {
border-bottom: 1px dotted;
cursor: help;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* change border colour to suit your needs */
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #cccccc;
margin: 1em 0;
padding: 0;
}
input,
select {
vertical-align: middle;
}
*,
*:before,
*:after {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-family: sans-serif;
padding: 60px 20px;
}
@media (min-width: 600px) {
body {
padding: 60px;
}
}
.head {
display: flex;
justify-content: center;
margin-bottom: 80px;
}
.head h2 {
font-size: 2.75rem;
font-weight: bold;
}
.range-slider {
display: flex;
justify-content: center;
}
.range-slider {
width: 100%;
}
.range-slider__range {
-webkit-appearance: none;
width: calc(90% - (73px));
height: 10px;
border-radius: 5px;
outline: none;
padding: 0;
margin: 0;
-webkit-transition: 0.2s;
opacity: 0.7;
transition: opacity 0.2s;
height: 20px;
outline: none;
background: linear-gradient(90deg, rgb(214, 214, 214) 60%, rgb(214, 214, 214) 60%);
border-radius: 12px;
}
.range-slider__range:hover {
opacity: 1;
}
.range-slider__range::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
background: #2c3e50;
cursor: pointer;
-webkit-transition: background .15s ease-in-out;
transition: background .15s ease-in-out;
}
.range-slider__range::-webkit-slider-thumb:hover {
background: #1abc9c;
}
.range-slider__range:active::-webkit-slider-thumb {
background: #1abc9c;
}
.range-slider__range::-moz-range-thumb {
width: 20px;
height: 20px;
border: 0;
border-radius: 50%;
background: #2c3e50;
cursor: pointer;
-webkit-transition: background .15s ease-in-out;
transition: background .15s ease-in-out;
}
.range-slider__range::-moz-range-thumb:hover {
background: #1abc9c;
}
.range-slider__range:active::-moz-range-thumb {
background: #1abc9c;
}
.range-slider__range:focus::-webkit-slider-thumb {
-webkit-box-shadow: 0 0 0 3px #fff, 0 0 0 6px #1abc9c;
box-shadow: 0 0 0 3px #fff, 0 0 0 6px #1abc9c;
}
.range-slider__value {
display: inline-block;
position: relative;
width: 70px;
color: #fff;
line-height: 20px;
text-align: center;
border-radius: 3px;
background: #2c3e50;
padding: 5px 10px;
margin-left: 10px;
}
.range-slider__value:after {
position: absolute;
top: 3px;
left: -7px;
width: 0;
height: 0;
border-top: 7px solid transparent;
border-right: 7px solid #2c3e50;
border-bottom: 7px solid transparent;
content: '';
}
::-moz-range-track {
background: #d7dcdf;
border: 0;
}
input::-moz-focus-inner,
input::-moz-focus-outer {
border: 0;
}
.values h2 {
font-weight: bold;
font-size: 35px;
color: #636363;
}
.values p {
color: #24A98F;
font-size: 20px;
margin-top: 5px;
}
.buttons {
margin-top: 50px;
width: 100%;
}
.btn button {
padding: 15px 80px;
border: none;
border-radius: 5px;
background-color: #58DBC2;
color: white;
font-size: 25px;
font-weight: bold;
box-shadow: 0px 5px 0px #45CDB1;
}
.chk p {
margin-top: 30px;
color: #6C6363;
font-size: 18px;
font-weight: bold;
line-height: 25px;
}
@media(max-width:500px) {
.chk p {
margin-top: 30px;
color: #6C6363;
font-size: 15px;
font-weight: bold;
line-height: 25px;
}
}
@media(max-width:768px) {
.head h2 {
font-size: 30px;
font-weight: bold;
}
}
@media(max-width:440px) {
.head h2 {
font-size: 20px;
font-weight: bold;
}
}
@media(max-width:503px) {
.btn button {
padding: 10px 50px;
border: none;
border-radius: 5px;
background-color: #58DBC2;
color: white;
font-size: 15px;
font-weight: bold;
box-shadow: 0px 5px 0px #45CDB1;
}
}
@media(max-width:351px) {
.btn button {
padding: 10px 30px;
border: none;
border-radius: 5px;
background-color: #58DBC2;
color: white;
font-size: 10px;
font-weight: bold;
box-shadow: 0px 5px 0px #45CDB1;
}
}
<script src="https://kit.fontawesome.com/b99f2762a6.js" crossorigin="anonymous"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<div class="heading">
<div class="container">
<div class="row">
<div class="col-12 col-lg-12">
<div class="head">
<h2>How Much Will You Save?</h2>
</div>
</div>
</div>
</div>
</div>
<div class="range">
<div class="container">
<div class="row">
<div class="col-12 col-l-12">
<div class="range-slider">
<input id="range" class="range-slider__range" type="range" value="150" step="5" min="150" max="1000">
<span id="value" class="range-slider__value">0</span>
</div>
</div>
</div>
</div>
</div>
<div class="words text-center mt-5">
<div class="container">
<div class="row">
<div class="col-12 col-lg-5">
<div class="values">
<h2>Homie Flat Fee </h2>
<p>What is this?</p>
</div>
</div>
<div class="col-12 col-lg-2 mb-sm-2 mb-md-2 mb-lg-0 mt-3 mt-sm-0 mt-md-3">
<div class="values">
<h2>VS</h2>
</div>
</div>
<div class="col-12 col-lg-5 ">
<div class="values">
<h2 id="saved">$4500K</h2>
<p>Traditional agent commission*
</p>
</div>
</div>
</div>
</div>
</div>
<div class="buttons text-center">
<div class="container">
<div class="row">
<div class="col-12 col-lg-12">
<div class="btn">
<button>Click to Save <span id="vvv">$2000</span></button>
</div>
<div class="chk text-sm-center text-md-center">
<p>Savings calculations based on difference between 3% listing agent commission and Homie’s flat listing fee. Savings may vary.</p>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>