Click here to Skip to main content
15,847,549 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I created a dialog-box on my landing page that pop-ups when the page loads only once, but i am not able to make it responsive. I tried setting min-width and max-width but that won't help. What should i try?

What I have tried:

#mask {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 9000;
  background-color: #000;
  display: none;

#boxes .window {
  position: absolute;
  left: 0;
  top: 0;
  width: 440px;
  height: 200px;
  display: none;
  z-index: 9999;
  padding: 20px;
  border-radius: 15px;
  text-align: center;

#boxes #dialog {
  width: 750px;
  height: 300px;
  padding: 10px;
  background-color: #ffffff;
  font-family: 'Segoe UI Light', sans-serif;
  font-size: 15pt;

#popupfoot {
  font-size: 16pt;
  position: absolute;
  bottom: 0px;
  width: 250px;
  left: 250px;

// This is Jquery.
$(document).ready(function() {	

 //if the cookie hasLaunch is not set, then show the modal window
    if (!readCookie('hasLaunch')) {
        //launch it
        //then set the cookie, so next time the modal won't be displaying again.
        createCookie('hasLaunch', 1, 1);

//if close button is clicked
$('.window .close').click(function (e) {
//Cancel the link behavior



function createCookie(name,value,days) {
    if (days) {
        var date = new Date();
        var expires = "; expires="+date.toGMTString();
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    return null;

function launchWindow(id) {

        //Get the screen height and width
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();

        //Set heigth and width to mask to fill up the whole screen

        //transition effect     

        //Get the window height and width
        var winH = $(window).height();
        var winW = $(window).width();

        //Set the popup window to center
        $(id).css('top',  winH/2-$(id).height()/2);
        $(id).css('left', winW/2-$(id).width()/2);

        //transition effect


// this is html code
  <div id="boxes">
  <div id="dialog" class="window">
    Welcome to GospelBox!!!
    <div id="popupfoot"> <a href="/content/about.html">  Okay </a> | <a  class="close" style="color:red;" href="#" >Skip this step </a> </div>
  <div id="mask"></div>

1 solution

Why not you are using bootstrap built-in responsive dialog box, like #modal ? and many others. Low cost and high efficiency, I would recommend you to work on.
Share this answer
Member 13339398 2-Aug-17 0:24am    
I tried bootstrap modal but it is not working, i even included bootstrap scripts and css. What should i do?
[no name] 2-Aug-17 1:23am    
You have to also include JQuery and Bootstrap.js files for Modal, see the following link and compare your code with the code in this link.
[no name] 2-Aug-17 1:24am
Hope so it will work....
Don't forget to mark my good rating. :)
Member 13339398 2-Aug-17 2:13am    
Thanks for the help, i was actually using previous version of bootstrap

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900