Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="canvas">
		<div class="calculator">
			<div class="canvas_1 form-box">
				<table class="text_1">
					<tr>
						<td>
							<div class="p_1">
								<p>Сумма займа</p>
							</div>
						</td>
						<td class="rightcol">
							<div class="input">
								<input type="number" id="slider_a_val" value="0" min="1000" max="50000" step="100" class="slider_1_val">
							</div>
						</td>
					</tr>
				</table>
				<div class="slidercontainer_1" align="center">
					<input type="range" min="1000" max="50000" value="10000" step="100" id="myRange1" class="input-range">
				</div>
			</div>
			<table class="text_2">
				<tr>
					<td>
						<div class="p_3">
							<p>1000</p>
						</div>
					</td>
					<td class="rightcol">
						<div class="p_4">
							<p>50000</p>
						</div>
					</td>
				</tr>
			</table>
			<div class="canvas_2 form-box">
				<table class="text_3">
					<tr>
						<td>
							<div class="p_5">
								<p>Срок кредитования</p>
							</div>
						</td>
						<td class="rightcol">
							<div class="input">
								<input type="number" id="slider_b_val" value="0" min="1" max="365" step="1" class="slider_2_val">
							</div>
						</td>
					</tr>
				</table>
				<div class="slidercontainer_2" align="center">
					<input type="range" min="1" max="365" value="10" step="1" id="myRange2" class="input-range">
				</div>
			</div>
			<table class="text_4">
				<tr>
					<td>
						<div class="p_7">
							<p>1 день</p>
						</div>
					</td>
					<td class="rightcol">
						<div class="p_8">
							<p>365 дней</p>
						</div>
					</td>
				</tr>
			</table>
			<div class="canvas_3">
				<form action="" method="post" align="center">
					<div class="submit_1">
						<p><input type="submit" name="Получить деньги" value="Получить деньги"></p>
					</div>
				</form>
			</div>
			<div class="canvas_4">
				<table class="text_5">
					<tr>
						<td>
							<div class="p_9">
                Итого к возврату
                <div class="p_10" id="p_10">10000</div>
                рублей, до
                <div class="p_11" id="p_11">30.08.2020</div>
							</div>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>
              
            
!

CSS

              
                input[type=range] {
  -webkit-appearance: none;/* Скрывает слайдер, чтобы можно было создать свой */
  width: 250px;
}
input[type=range]::-webkit-slider-thumb {
  border: 4px solid yellow;
  height: 15px;
  width: 15px;
  border-radius: 50px;
  border-color: yellow;
  cursor: pointer;
  background: red;
  -webkit-appearance: none;
  margin-top: -10px;
}
/* Тоже самое для Firefox */
input[type=range]::-moz-range-thumb {
  border: 4px solid yellow;
  height: 15px;
  width: 15px;
  border-radius: 50px;
  border-color: yellow;
  cursor: pointer;
  background: red;
  -webkit-appearance: none;
}
/* Тоже самое для IE */
input[type=range]::-ms-thumb {
  border: 4px solid yellow;
  height: 15px;
  width: 15px;
  border-radius: 50px;
  border-color: yellow;
  cursor: pointer;
  background: red;
  -webkit-appearance: none;
}
input[type=range]:focus {
  outline: none; /* Убирает голубую границу у элемента. Хотя, возможно, и стоит создавать некоторое оформления для состояния фокуса в целях обеспечения доступности. */
}
input[type=range]::-ms-track {
  width: 100%;
  cursor: pointer;
  background: transparent; /* Скрывает слайдер, чтобы можно было добавить собственные стили. */
  border-color: transparent;
  color: transparent;
}
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 3px;
  cursor: pointer;
  background-color: red;
  border-radius: 1px;
  border: 1px solid red;
}
input[type=range]:focus::-webkit-slider-runnable-track {
  background: red;
}
input[type=range]::-moz-range-track {
  width: 100%;
  height: 3px;
  cursor: pointer;
  background-color: red;
  border-radius: 1px;
  border: 1px solid red;
}
input[type=range]::-ms-track {
  width: 100%;
  height: 8.4px;
  cursor: pointer;
  background: transparent;
  border-color: transparent;
  border-width: 16px 0;
  color: transparent;
}
input[type=range]::-ms-fill-lower {
  width: 100%;
  height: 3px;
  cursor: pointer;
  background-color: red;
  border-radius: 1px;
  border: 1px solid red;
}
input[type=range]:focus::-ms-fill-lower {
  background: red;
}
input[type=range]::-ms-fill-upper {
  width: 100%;
  height: 3px;
  cursor: pointer;
  background-color: red;
  border-radius: 1px;
  border: 1px solid red;
}
input[type=range]:focus::-ms-fill-upper {
  background: red;
}
.canvas {
  background: white;
  border-radius: 10px 10px 10px 10px;
  box-shadow: 3px 0px 5px 2px #b0b0af;
  width: 300px;
  height: 340px;
  margin: 0 auto;
}
.canvas_1 {
  outline: 1px solid black;
  width: 250px;
  height: 35px;
  margin: 0 auto;
}
.canvas_2 {
  outline: 1px solid black;
  width: 250px;
  height: 35px;
  margin: 0 auto;
}
.canvas_3 {
  width: 300px;
  height: 100px;
  position: absolute;
  margin-top: 22px;
}
.canvas_4 {
  background: #006633;
  border-radius: 0px 0px 10px 10px;
  width: 300px;
  height: 100px;
  position: absolute;
  margin-top: 100px;
}
.slidercontainer_1 {
  position: absolute;
  margin-top: -15px;
  margin-left: -2px;
}
.slidercontainer_2 {
  position: absolute;
  margin-top: -15px;
  margin-left: -2px;
}
#slider_a_val, #slider_b_val {
}
table.text_1, table.text_2, table.text_3, table.text_4 {
  width: 100%;
}
table.text_1 td, table.text_2 td, table.text_3 td, table.text_4 td{
  width: 50%;
  vertical-align: middle;
}
.text_1 td.rightcol, .text_2 td.rightcol, .text_3 td.rightcol, .text_4 td.rightcol { /* Правая ячейка */ 
  text-align: right; /* Выравнивание по правому краю */
}
table.text_5 {
  width: 100%;
}
.text_5 td{
  width: 100%;
  text-align: center;
}
.p_1, .p_2 {
  font-family: "Arial";
}
.p_1 {
  font-size: 11px;
}
.p_2 {
  font-size: 13px;
}
.p_3, .p_4 {
  font-family: "Arial";
  font-size: 11px;
}
.p_3 {
  margin-left: 20px;
}
.p_4 {
  margin-right: 20px;
}
.p_5, .p_6 {
  font-family: "Arial";
}
.p_5 {
  font-size: 11px;
}
.p_6 {
  font-size: 13px;
}
.p_7, .p_8 {
  font-family: "Arial";
  font-size: 11px;
}
.p_7 {
  margin-left: 20px;
}
.p_8 {
  margin-right: 20px;
}
.p_9 {
  color: white;
  font-family: "Arial";
  font-size: 17px;
  margin-top: 8px;
}
.p_10 {
  font-size: 18px;
  color: #dfdfdf;
}
.p_11 {
  font-size: 18px;
  color: #dfdfdf;
}
input[type=submit] {
  background: red;
  color: white;
  box-shadow: 2px 2px #b0b0af;
  border-radius: 50px;
  border: none;
  width: 170px;
  height: 35px;
  font-size: 12pt;
  font-family: "Arial";
  font-weight: bold;
}
              
            
!

JS

              
                const inputNumber = $('.input input[type=number]');
const inputRange = $('.input-range');

inputRange.each(function () {
  const parent = $(this).parents('.form-box');
  parent.find(inputNumber).val($(this).val());
})

inputNumber.on('input', onInputHandler)
inputRange.on('input', onInputHandler)

function onInputHandler() {
  const val = $(this).val();
  const maxVal = $(this).attr('max');
  const minVal = $(this).attr('min');
  const type = $(this).attr('type');
  if(val > parseInt(maxVal)){
    $(this).val(maxVal);
  }
  if(val < minVal){
    $(this).val(minVal);
  }
  const parent = $(this).parents('.form-box');
  parent.find(type === 'range' ? inputNumber : inputRange).val($(this).val());
  calculate();
}
  
function calculate() {
  // Получаем значения суммы займа и кол-во дней:
  let sum = parseInt($('#slider_a_val').val())
  let days = parseInt($('#slider_b_val').val())
  // Считаем дату:
  let date = new Date();
  date.setDate(date.getDate() + days);
  let mm = date.getMonth() + 1;
  if (mm < 10) mm = '0' + mm;
  let dd = date.getDate()
  if (dd < 10) dd = '0' + dd
  let yyyy = date.getFullYear()
  if (yyyy < 10) yyyy = '0' + yyyy
  let textDate = dd + '.' + mm + '.' + yyyy
  // Здесь можно посчитать сумму для возврата:
  if (days > 5) sum *= (days-5)/100+1
  // Устанавливаем значения:
  $('#p_10').text(parseInt(sum))
  $('#p_11').text(textDate)
}
              
            
!
999px

Console