Created
November 21, 2016 03:51
-
-
Save n8finch/7c02dee171d3ae0089cee19b752f1283 to your computer and use it in GitHub Desktop.
Make jQuery UI's Dialog Popup Responsive with JavaScript
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
//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