We change the css overflow property of the background in the onShow and onClose functions..
Example:
$("#sample").modal({
maxWidth:800, minHeight:800,
onShow: function(dialog) {
$("html,body").css("overflow","hidden");
//YOur remaining javascript...
},
onClose: function(dialog) {
$("html,body").css("overflow","auto");
$.modal.close();
}
});