Created
April 8, 2015 22:11
-
-
Save mnpenner/b214b93ab221cf93ffa0 to your computer and use it in GitHub Desktop.
jQuery UI Dialog Fixed Position example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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