How can I make an Input of type Text change its value when I click inside it and drag the mouse up to increase the value and down to decrease the value. Only when the mouse moves up and down does the change in value of the input (validate min and max) I have this, but I can not make it work as a wish. Look at the effect I want to do link and this is what I have so far link but I need it to work only when the mouse click is pressed osea as dragging up or down as well as the example put
var clicking = false;
$('this').click(function() {
clicking = false;
});
$('#change_value_up_down').mouseover(function() {
clicking = true;
});
var i = 0;
var y = 0;
$(this).mousemove(function(my) {
if (clicking === false) {
return false;
} else {
// change value
if (my.pageY <= $('#change_value_up_down').offset().top + $('#change_value_up_down').css('width').replace('px', '') / 10) {
y = parseInt($('#change_value_up_down').val()) + 1;
$('.movestatus').text('plus');
} else {
y = parseInt($('#change_value_up_down').val()) - 1;
$('.movestatus').text('minus');
}
$('#change_value_up_down').val(parseInt(y));
// Mouse click + moving logic here
//$('.movestatus').text('mouse moved ' + i);
i++;
}
});
$('#change_value_up_down').mouseup(function(e) {
clicking = false;
//e.stopPropagation();
});
$('.selector').mouseup(function(e) {
i = 0;
});