$('.tur').bind("change keyup input click", function() {
$('body').on('change keyup input click', '.tur', function() {
.scrollbar-locked {
position: relative;
overflow: hidden;
width: 100%;
height: 100%;
-webkit-overflow-scrolling: auto;
-ms-touch-action: pan-x;
touch-action: pan-x;
}
var body = $('body');
var ios = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
var disableScrollTouchStart = function(event) {
this.allowUp = (this.scrollTop > 0);
this.allowDown = (this.scrollTop < this.scrollHeight - this.clientHeight);
this.slideBeginY = event.pageY;
};
var disableScrollTouchMove = function(event) {
var up = (event.pageY > this.slideBeginY);
var down = (event.pageY < this.slideBeginY);
this.slideBeginY = event.pageY;
if ((up && this.allowUp) || (down && this.allowDown)) {
event.stopPropagation();
} else {
event.preventDefault();
}
};
var xStart, yStart = 0;
var disableDocumentTouchStart = function(e) {
xStart = e.touches[0].screenX;
yStart = e.touches[0].screenY;
};
var disableDocumentTouchMove = function(e) {
if (ios) {
if (typeof e.cancelable !== 'boolean' || e.cancelable) {
e.preventDefault();
e.stopPropagation();
}else{
console.warn('The following event couldn`t be canceled:');
console.dir(e);
}
return false;
}
var target = $(e.target);
if (!target.data('noscroll')) {
return;
}
var xMovement = Math.abs(e.touches[0].screenX - xStart);
var yMovement = Math.abs(e.touches[0].screenY - yStart);
if ((yMovement * 3) > xMovement) {
e.preventDefault();
e.stopPropagation();
}
};
var disableScroll = function() {
if (ios) {
$('.scrollable').each(function() {
this.addEventListener('touchstart', disableScrollTouchStart, false);
this.addEventListener('touchmove', disableScrollTouchMove, false);
});
}
body.addClass('scrollbar-locked');
document.addEventListener('touchstart', disableDocumentTouchStart, false);
document.addEventListener('touchmove', disableDocumentTouchMove, false);
};
var enableScroll = function() {
if (ios) {
$('.scrollable').each(function() {
this.removeEventListener('touchstart', disableScrollTouchStart, false);
this.removeEventListener('touchmove', disableScrollTouchMove, false);
});
}
body.removeClass('scrollbar-locked');
document.removeEventListener('touchstart', disableDocumentTouchStart, false);
document.removeEventListener('touchmove', disableDocumentTouchMove, false);
}