0

Fixing a jQuery UI draggable element to an axis is pretty straightforward. You just set the axis option, but that still allows for two directions of dragging.

How can one limit the dragging to only one direction ( down )?

$('.settings').draggable({axis:'y'}); makes .settings draggable up and down, but how can I get it to only work in the downwards direction?

4

1 回答 1

1
$('#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
        });
    }
});
于 2013-08-03T04:42:05.550 回答