$(".image_drag img").draggable({
stop: function(ev, ui) {
var hel = ui.helper, pos = ui.position;
//horizontal
var h = -(hel.outerHeight() - $(hel).parent().outerHeight());
if (pos.top >= 0) {
hel.animate({ top: 0 });
} else if (pos.top <= h) {
hel.animate({ top: h });
}
// vertical
var v = -(hel.outerWidth() - $(hel).parent().outerWidth());
if (pos.left >= 0) {
hel.animate({ left: 0 });
} else if (pos.left <= v) {
hel.animate({ left: v });
}
}
});
Или вы можете вручную установить ограничение для вашего элемента:
$("img").draggable({ containment: [-99, -119, 0, 0], scroll: false });