Enhance the responsiveness of full-screen pop-ups

My current project involves creating a full-screen pop-up for a specific application.

  /* Custom Full Screen Popup */
                .fullscreen-popup {
                  position: fixed;
                  top: 0;
                  left: 0;
                  width: 100%;
                  height: 100%;
                  background-color: rgba(255, 255, 255);
                  display: flex;
                  justify-content: center;
                  align-items: center;
                }
                
                .close-button {
                  position: absolute;
                  top: 10px;
                  right: 10px;
                  padding: 8px 16px;
                  border: none;
                  border-radius: 4px;
                  background-color: #f44336;
                  color: #fff;
                  cursor: pointer;
                }
                
                .popup-content {
                  position: relative;
                  padding: 20px;
                  background-color: #ffffff;
                  border-radius: 8px;
                  text-align: justify;
                  max-width: 80vw; /* Adjust max width for smaller screens */
                  overflow-y: auto; /* Enable vertical scrolling if needed */
                }
                
                /* Media Queries for Responsive Design */
                
                /* Tablet and Larger Screens */
                @media screen and (min-width: 768px) {
                  .details-container {
                    grid-template-columns: repeat(2, minmax(300px, 1fr));
                  }
                }
                
                /* Mobile Screens */
                @media screen and (max-width: 767px) {
                  .details-container {
                    grid-template-columns: repeat(1, minmax(100%, 1fr));
                  }
                
                  /* Full Screen Popup Adjustments */
                  .fullscreen-popup {
                    padding: 20px;
                  }
                
                  .close-button {
                    top: 5px;
                    right: 5px;
                  }
                
                  .popup {
                    width: 90%;
                    max-width: 90vw;
                  }
                }
                img{
                    height: 50%;
                    width: 50%;
                }
<div class="fullscreen-popup">
               <div class="popup-content">
                    <h2>This is the title of h2</h2>
                    <img src="https://wallpapers.com/images/hd/720p-nature-background-7dtz4pan3cr3ot5v.jpg">
                    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Sint assumenda nihil voluptas adipisci dolor quisquam totam doloremque corrupti laudantium ad consectetur quaerat optio quidem nulla possimus laborum tempore atque...</p>
                     <button class="close-button">Close</button>
                </div>
            </div>

In my implementation, I have successfully added a functional close button but removed some unnecessary code to simplify the project.

The issue I'm facing is that sometimes the h2 heading, popup content, and close button do not appear on mobile screens. Additionally, both vertical and horizontal scrolling is disabled on mobile devices.

I've experimented with various CSS properties such as position, max-width, and max-height, but have been unsuccessful in resolving these issues on mobile devices. The page's behavior on mobiles has been erratic.

If you could provide assistance in fixing these problems, it would be greatly appreciated.

Answer №1

/* Custom Full Screen Popup */

.fullscreen-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(255, 255, 255);
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  background-color: #f44336;
  color: #fff;
  cursor: pointer;
}

.popup-content {
  position: relative;
  padding: 20px;
  background-color: #ffffff;
  border-radius: 8px;
  text-align: justify;
  max-width: 80vw; /* Adjust max width for smaller screens */
  overflow-y: auto; /* Allow vertical scrolling if needed */
  max-height: 90vh;
}

/* Media Queries for Responsive Design */

/* Tablet and Larger Screens */
@media screen and (min-width: 768px) {
  .details-container {
    grid-template-columns: repeat(2, minmax(300px, 1fr));
  }
}

/* Mobile Screens */
@media screen and (max-width: 767px) {
  .details-container {
    grid-template-columns: repeat(1, minmax(100%, 1fr));
  }

  /* Full Screen Popup Adjustments */
  .fullscreen-popup {
    padding: 20px;
  }

  .close-button {
    top: 5px;
    right: 5px;
  }

  .popup {
    width: 90%;
    max-width: 90vw;
  }
}
img {
  height: 50%;
  width: 50%;
}
<div class="fullscreen-popup">
  <div class="popup-content">
    <h2>This is a new title of h2</h2>
    <img
      src="https://new-wallpapers.com/images/hd/720p-nature-background-7dtz4pan3cr3ot5v.jpg"
    />
    <p>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Sint assumenda,
      nihil voluptas adipisci dolor quisquam totam doloremque corrupti
      laudantium ad consectetur quaerat optio quidem nulla possimus laborum
      tempore atque. Ab.Lorem ipsum dolor sit amet consectetur adipisicing
      elit. Sint assumenda nihil voluptas adipisci dolor quisquam totam
      doloremque corrupti laudantium ad consectetur quaerat optio quidem nulla
      possimus laborum tempore atque. Ab.Lorem ipsum dolor sit amet consectetur
      adipisicing elit. Sint assumenda nihil voluptas adipisci dolor quisquam
      totam doloremque corrupti laudantium ad consectetur quaerat optio quidem
      nulla possimus laborum tempore atque. Ab.
    </p>
    <button class="close-button">Close</button>
  </div>
</div>

give it a try

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Styling text in JavaScript and CSS with colored fonts and underlines

I am looking to customize the CSS for the font style. <div id="a" onmouseover="chbg('red','b')" onmouseout="chbg('white','b')">This will change b element</div> <div id="b">This is element b</div ...

Why are my elements not appearing where I want them to in absolute positioning?

Could use some help with a seemingly simple question, I just need some clarity on this issue. Background: I am working on developing a complex website and one of my ideas involves generating a series of boxes on the screen. For various reasons that are t ...

What steps should be taken to retrieve the contents of a file that has been chosen using the browse

You have successfully implemented a browse button that allows the user to navigate the directory and choose a file. The path and file name are then displayed in the text element of the Browse button complex. Now, the question arises - how can I extract dat ...

steps for converting .SCSS files to .CSS in a project template

As a beginner developer, my expertise lies in HTML/CSS/JS and some fundamentals of their frameworks. Recently, I invested in this Template from template monster for a specific project () WHAT I NEED - My goal is to modify the primary theme color of the t ...

What is the best way to switch the site header in JavaScript or jQuery?

I have created a Bootstrap menu design and I am looking to add a sliding functionality to it. My goal is to hide the menu when scrolling down and display it when scrolling up (slide-down / slide-up). For implementing this feature, I plan to utilize jQuery ...

Show two choices in a select box next to each other

I've been attempting to display a select box with two options side by side in a list format. Struggling to find any libraries that can achieve this functionality. Here is an example: <select> <option x><option y> <optio ...

Image optimization using media queries

In the scenario where the maximum width is 1220px, I want to change the main display to column. This is what I have implemented: @media (max-width: 1220px) { .main { flex-direction: column; } However, when the width reaches 1220px, the image disap ...

Can you use logical AND in Selenium XPath to combine multiple contains() filters?

My objective is to identify a specific element using Selenium: <a class="ABC" href="#" data-test-id="XXX|YYY|ZZZ"> There are various elements on the page with attributes matching "ABC", "XXX", " ...

InnerHTML failing to append HTML content

Almost at the finish line with this code! I already have a footer in place, but when the button is clicked, it smoothly slides down along with its contents. Once it's done sliding, I utilize JavaScript to swap out that footer and its contents with a n ...

Exploring the implementation of Javascript, HTML, PHP, and Ajax in programming

<div class="navigation"> <a class="prev" href="index.php?month=__prev_month__" onclick="$('#calendar').load('index.php?month=__prev_month__&_r=' + Math.random()); return false;"></a> <!-- <div class="title" & ...

Tips on using JQuery to extract form field information from a drop-down menu, display it in a div, and then compare it with the subsequently

In my HTML file, I am using two dropdown lists and JQuery for validation. First, I need to save the selected items from both dropdown lists in a variable and then compare them with the next selection. If the data from both dropdown lists match, an alert m ...

Creating a Vertical Stack of Divs Using HTML and CSS

I've attempted various methods to align the links vertically in the left-most column, but without success. Any suggestions or advice would be greatly appreciated! http://jsfiddle.net/adRuz/112/ .box { background: #E8E8E8; border-radius: 8px ...

Display images fetched using ajax requests

Looking to retrieve the image source path using the code below: $.ajax({ url: 'api/catalogs.php?action=fetchimg&CatalogId=' + d.CategoryId, type: 'GET', dataType: "json", success: function(response) { var path = respo ...

Styles and CSS have been successfully loaded, however, the content is not appearing

After attempting to import a web HTML CSS template into my self-made MVC, I encountered an issue. While the template works properly on its own, it fails to connect to the CSS files and display proper styles when accessed through my controller. Instead, onl ...

Creating a Shadow Effect on CSS Triangles

I have created a unique design that resembles a large arrow pointing to the right. <div style=" font-size: 0px; line-height: 0%; width: 100px; border-bottom: 80px solid #8cb622; border-right: 62px solid #dadbdf; "></div> <div style=" font ...

When attempting to assign a variable in my ngModel, what issue could be causing a problem?

I am facing an issue while trying to implement ngModel in my code. The code is not executing properly and an error is being displayed. Below is the code snippet: contact-form.component.html: <div class="container"> <form> <div class ...

Create a button that matches the dimensions of the background image

I am working with a form that includes a submit button featuring a background image. <button type="button" class="button" alt="Send" onclick="validate_form_newsletter_wide( form )"></button> Everything works well when I define the dimensions ...

The requested resource at http://js:port/socket.io/1/ could not be located (Error 404

Having trouble connecting with Socket.io. This is the server-side code: function chatserver(){ var express = require('express'), app = express(), server = require('http').createServer(app).listen(app.get('port'),function ...

Is it possible to refresh a table that is currently displayed in a model popup?

My code to reload a table or div inside a model popup continuously is not working as expected. Can you help me with this issue? I attempted to utilize ajax for this purpose but unfortunately, the code below is not updating chats (I am working on a chat ta ...

Center the image to always align with the text

I am looking to display an image alongside some text, where the number of text lines can vary. It could be one, two, or three lines of text. Here's how it should be handled: If there is only one line of text: The image should be centered with the te ...