Wednesday, August 1, 2012

How to prevent page scroll when showing jQuery Dialog

Sometimes showing a jQuery Dialog in a scrolling page sucks so to hide scroll bars(prevent scrolling) use the following code.
$( ".selector" ).dialog({
   open: function(event, ui) { jQuery("#Body").css("overflow", "hidden"); },
   close: function () { jQuery("#Body").css("overflow", "auto"); }
});
HTH



No comments:

Post a Comment