Last active
August 29, 2015 14:00
-
-
Save xnimorz/11284240 to your computer and use it in GitHub Desktop.
input linear
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.input-example { | |
width: 400px; | |
} | |
.input-block { | |
width: 100%; | |
height: 10px; | |
cursor: pointer; | |
background-color: #fff; | |
} | |
.input { | |
height: 20px; | |
font-size: 14px; | |
} | |
.input-block-carriage { | |
cursor: pointer; | |
width: 20px; | |
height: 10px; | |
} | |
// Создаем стрелку, посредством css | |
.input-block-carriage:after { | |
height: 0; | |
position: relative; | |
top: -16px; | |
width: 0; | |
padding: 0; | |
cursor: pointer; | |
border-right: 0.5rem solid transparent; | |
border-bottom: 0.5rem solid #333; | |
border-left: 0.5rem solid transparent; | |
content: ''; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="input-example"> | |
<input type="text" class="input input-block js-input-linear" placeholder="Тяни каретку!"> | |
<div class="input-block js-input-linear-carriage"><div class="input-block-carriage"></div></div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Организуем в качестве примера демонстрацию работы события окончания "перетягивания" каретки | |
$('.js-input-linear-carriage').on('carriage:move', function(e, args) { | |
$('.js-input-linear').val(args.value); | |
}) | |
.on('carriage:end', function(e, args) { | |
$('.js-input-mouse-up').html(args.value); | |
}); | |
UICarriage.create( | |
$('.js-input-linear-carriage'), | |
{ | |
maxOffset: 390, | |
carriageMoveEvent: 'carriage:move', | |
carriageMoveEndEvent: 'carriage:end' | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment