I have a draggable container that holds a varying amount of children displayed side by side with display: inline-block
. I want the containment to be based on the offset of either the first or last child, so the user is able to drag all but one (either first or last) offscreen in either direction.
drag: function(){//prevent dragging once last element offset is within 10% of window width
if ($('.element:last').offset().left < $(window).width() * .10)){
return false;
}
}
The problem is that once I return false, I can no longer drag. Some variation of containment seems like the only option here, but I'm not quite sure how to feed it such a complicated condition.