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

Ways to recognize when a button has been pressed

I developed my website using the CodeIgniter framework. Here is my personal website On the homepage, if I click on the "landscape" picture (top right) or the "landscape" button in the menu, it takes me to the "landscape" page. However, when I return to t ...

AngularJS: How can I eliminate the #! from a URL?

Looking for guidance on how to remove #! from the URL in AngularJS using ng-route. Can anyone provide a step-by-step process on removing #!? Below is the code snippet: index.html <head> <script src="https://ajax.googleapis.com/ajax/libs/ang ...

Is there a way to create a timed fadeIn and fadeOut effect for a div using HTML and CSS?

I have a single div that initially displays text, and I want it to fade out after a specific time so that another div will then fade in. However, my attempt at coding this transition is not producing the desired result: $(function() { $(".preloa ...

Issue with AngularJS in Internet Explorer 7: "querySelector" property or method not supported by object

Incorporating angularjs into an existing asp.net project has presented a challenge due to the project's dependency on IE 7 compatibility mode. Upon running the project, an error from the angularjs file was encountered: Object doesn't support pro ...

Apply a specific style conditionally using Angular's ng-repeat directive

Currently, I am utilizing ng-repeat to iterate through a list of divs and manually adding items to the JSON that is rendering these divs. My goal is to position the last div that I add in the JSON at the location where the mouse cursor is, while keeping th ...

Swiftly accessing information from the internet

Can someone please guide me on how to retrieve data from a website using Swift? My goal is to be able to update the content on the website without having to make changes to the entire application. I believe I just need to fetch text from a server (and I&ap ...

The Kenburn zoom image effect fails to function

I want to implement a zoom effect on an image using the Ken Burns effect when it is clicked. However, the code I have written does not seem to be working as expected. Here is the code snippet: $(document).ready(function () { $('.kenburns').on( ...

Design a custom cover page before printing using the window.print() method

When it comes to printing, I have a header and footer displayed on each page. However, I want the first page to be clean with just a picture or title, without the header and footer that appear on subsequent pages. I've attempted to use CSS like this ...

Create a function that triggers a fade-out effect on one button when another button is clicked

Hello everyone! I'm still getting the hang of things around here so please be kind. I need some assistance with my weather app project. Specifically, I've created two buttons and I want to make it so that when one is clicked, the other fades to g ...

How can we use fetch to grab some data?

I put together an Express application quickly, here's how it looks: const express = require("express"); const app = express(); const port = 3000; app.get("/content/1/", (req, res) => res.send("Thinking about taking out a new loan? Call us today. ...

What is the best way to position a single element in React using the Grid Component without causing any overlap?

I am struggling with positioning 3 components on my react page: PageHeader, SideMenu & FeatureList (which consists of Display Cards). Here is the code for each component: App.js // App.js code here... PageHeader.js // PageHeader.js code here... SideMenu ...

I am experiencing issues with the rendering of my q-btn elements in Quasar and they are

I recently started using Quasar and encountered an issue with my q-btn component buttons displaying white backgrounds at random, despite having added a background-color in the external stylesheets. Here are some examples of this perplexing problem: The e ...

Utilizing the position relative property with Firefox browser

Similar Question: Is Firefox compatible with position: relative on table elements? Check out this example: a full-width menu formatted as a table with ul dropdown menus. Everything works as expected in IE and Opera, but in Firefox the dropdown uls ex ...

Is it possible for a media query to target only 2 elements instead of all 3?

Currently, I am dealing with an older website for a client, and it appears that a media query is not correctly affecting three specific classes out of the total. These problematic classes are .free-ship, .wholesale, .chronicles The CSS styling for these c ...

Show the cell data when the checkbox next to it is selected

I have a specific table setup and I am trying to display the content of the table cell if its corresponding checkbox is checked upon clicking a button. For example: If Row2 is checked, an alert box should display Row2 Below is my code snippet, Java ...

Show equally sized elements using a grid system

I need assistance with displaying fields in a row using CSS grid. I want to display 3 fields in a row with equal width, and if there are only 2 fields, they should also have equal widths. Additionally, if there is only one field, it should take up the full ...

Is there a way to use an Angular expression inside an HTML document to determine if a variable is a boolean type?

I'm working with an element in my HTML where I need to determine the type of a variable, specifically whether it's a boolean or not. <button process-indicator="{{typeof(button.processIndicator) === 'boolean' ? 'modalProcess&apo ...

Should I convert to an image or utilize the canvas?

I'm debating whether it's more efficient to convert a canvas drawing into an image before inserting it into the DOM, or if it's better to simply add the canvas itself. My method involves utilizing canvas to generate the image. ...

Click here to open in a new tab and experience the ever-changing dynamic

Imagine a scenario where a property site displays the main viewed property ad at the top, with smaller ads in square divs below. When a user clicks on one of the smaller ads, it dynamically swaps places with the main ad thanks to JavaScript. All ad data is ...

What are the steps to ensure my header spans the full width on both mobile and desktop platforms in an HTML email?

Hello, I am nearly finished with composing this email, but an issue has arisen on mobile where the header is not stretching to full width. My goal is to make the header image fill the entire width of the screen on a mobile device, but I keep encountering o ...