Skip to content

Instantly share code, notes, and snippets.

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 n8finch/7c02dee171d3ae0089cee19b752f1283 to your computer and use it in GitHub Desktop.
Save n8finch/7c02dee171d3ae0089cee19b752f1283 to your computer and use it in GitHub Desktop.
Make jQuery UI's Dialog Popup Responsive with JavaScript
//Get Window Screen Width
var screenWidth, screenHeight, dialogWidth, dialogHeight, isDesktop;
screenWidth = window.screen.width;
screenHeight = window.screen.height;
if ( screenWidth < 500 ) {
dialogWidth = screenWidth * .95;
dialogHeight = screenHeight * .95;
} else {
dialogWidth = 500;
dialogHeight = 500;
isDesktop = true;
}
setTimeout(function(){
$(function() {
$("#n8f-popup-login-message").dialog({
title: 'Welcome to Startup Academy!',
draggable: false,
modal: true,
height: dialogHeight,
width: dialogWidth,
closeOnEscape: false,
open: function() {
if(isDesktop) {
disableScroll();
}
}
});
});
}, 2000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment