[英]Make jQuery UI draggable element only draggable in down direction
将jQuery UI可拖动元素固定到轴非常简单。 您只需设置轴选项,但这仍然允许两个方向拖动。
如何将拖动限制在一个方向(向下)?
$('.settings').draggable({axis:'y'});
使.settings
可以上下拖动,但是如何才能使其仅在向下方向上工作呢?
$('#repel').mousemove(function () {
var z = $(window).scrollTop();
var o = $('#repel').offset().top;
var h = $('#repel').height();
$("#containment-wrapper").css({
top: o + h -2000
});
if (z < 10) {
$("#containment-wrapper").css({
top: -850
});
} else {
$("#containment-wrapper").css({
top: o + h -2000
});
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.