Skip to content

Instantly share code, notes, and snippets.

@mnpenner
Created April 8, 2015 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnpenner/b214b93ab221cf93ffa0 to your computer and use it in GitHub Desktop.
Save mnpenner/b214b93ab221cf93ffa0 to your computer and use it in GitHub Desktop.
jQuery UI Dialog Fixed Position example
function resizeDialog(event, ui) {
var position = [(Math.floor(ui.position.left) - $(window).scrollLeft()),
(Math.floor(ui.position.top) - $(window).scrollTop())];
$(event.target).parent().css('position', 'fixed');
$(dlg).dialog('option','position',position);
}
// based on http://stackoverflow.com/a/9242751/65387
$('#error_container').dialog({
create: function(event, ui) {
$(event.target).parent().css('position', 'fixed');
},
resize: _.throttle(resizeDialog,50),
resizeStop: resizeDialog,
autoOpen: false,
width: 500,
height: 300,
title: "Scheduling Conflicts"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment