Angular modal layout not behaving responsively

My current project involves working with Angular 7 and Bootstrap 4, where I utilize PSPDFKit to open PDF files in a viewer placed within a modal.

One issue that I've encountered is that the modal does not adapt responsively to different screen sizes. Additionally, I am aiming for the PSPDFKit viewer to occupy the entire space within the modal (100% size).

You can view screenshots of the problem here and here.

Below is the HTML code snippet:

<style>
  #app {
  
    width: 100%;
    height: 100%;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
  }
</style>

...

The CSS code aimed at improving modal responsiveness is provided below:

.modal{
  z-index:1000 !important;
}

...

Lastly, here's the code snippet used to trigger the opening of the modal:

 openModalWithComponent() {
    const initialState = {
      list: [
        'Open a modal with component',
        'Pass your data',
        'Do something else',
        '...'
      ],
      title: 'Document Viewer'
    };
    this.bsModalRef = this.modalService.show(ModalComponent, Object.assign({ initialState }, { class: 'gray modal-lg' }));
    this.bsModalRef.content.closeBtnName = 'Close';
  }

Answer №1

It appears that your modal is utilizing a specific style that is preventing it from adjusting its width and consequently, the width of its content as well:

.modal-dialog.modal-800 {
  width: 800px;
  margin: 30px auto;
}

Additionally, the margins specified in this particular declaration are causing the PSPDFKit viewer content to not fully expand to fill the container width.

If you have any further questions or need assistance, please don't hesitate to reach out to our support team at PSPDFKit. We are here to assist you with any concerns you may have :)

Answer №2

Utilize breakpoints within the CSS of the ModalComponent for optimal responsiveness

For instance:

@media only screen and (max-width: 640px) {}

@media only screen and (min-width: 640px) {}

@media only screen and (min-width: 768px) {}

@media only screen and (min-width: 1200px) {}

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

Disabling ngIf but still utilizing ngContent will render the template bindings

Creating a basic component in the following way: @Component({ selector: 'loader', template: `<div *ngIf='false'> <ng-content></ng-content> </div>`, }) export class Loader {} When it is imple ...

Flame-inspired CSS editor

My current CSS editing workflow goes something like this: I ask for feedback on a page Suggestions are given to make post titles bigger I use Firebug to inspect the post title element I locate the corresponding CSS statement in Firebug (like h2.post_title ...

Step-by-step guide on displaying a Bootstrap notification/toast (using MDBootstrap) following an error returned by Laravel

I am currently working on a project that resembles Instagram, but with basic features implemented using Laravel and MDBootstrap. Take a look at my design here As I create a form for updating personal information, I want to ensure that if Laravel encounte ...

Tips for Declaring Angular FormGroup Controls Outside of Component

In a component (named: Hello in the sample), there is a FormGroup. The controls of the FormGroup need to be defined outside the component using ng-content. An example on stackblitz: https://stackblitz.com/edit/angular-ivy-bqczmm?file=src%2Fapp%2Fhello.com ...

Is it possible to achieve two-way data binding across various components in Angular 2?

Currently, I am facing an issue with two components in my Angular project - HomePageComponent and StudentResultsComponent. The problem arises when I type something in the input field of HomePageComponent; the value is not updating in the StudentResultsComp ...

Deactivate the focus state when hovering over different items in the navigation bar

Currently facing an issue with my Navbar items having underline animation on hover. Once clicked, the animation persists. However, when hovering over a neighboring navbar item, the underlines appear next to each other, creating the illusion of one long lin ...

Choose an image to be displayed at either full width or full height, depending on which dimension is reached first

I have a query regarding resizing an image within a div to either 100% width or 100% height of the containing div. Despite setting max-height and max-width to 100% as recommended here, I still encounter overflow issues without wanting to crop the image usi ...

Encountering an issue while running the ng build --prod command in Angular

I ran into an issue while trying to execute the command ng build --prod in Angular. I've completed my small project and now need to generate the necessary files for uploading to my hosting provider. ERROR - ANGULAR CLI C:\Users\Johan Cor ...

Navigating Angular QueryList through loops

I am currently trying to gather all the images in my component and store them in an array. To achieve this, I am utilizing Angular's @ViewChildren which returns a QueryList of ElementRef: @ViewChildren('img', { read: ElementRef }) images: Q ...

Vertical text on rigid bars

Hey there, I've encountered an intriguing problem that's got me stumped. I'm attempting to create a menu made up of vertical bars that span the full height of the window and have a fixed position. I want the text within these bars to displa ...

Troubles with resizing background images in Google Chrome

I am currently working on the development of this website: The site is nearly complete, but I am facing some issues with the resizing of two background images. While it works perfectly on Firefox, the second background (text background) is not resizing co ...

Exciting Updates in Bootstrap v4 Beta 2 - Enhanced Display Classes for Rows

Currently in the process of updating my frontend from V4 Alpha 6 to the most recent Beta 2 release. One challenge I am facing pertains to hiding certain 'row' elements using 'hidden-*-down' previously. Considering the new display clas ...

Dynamic background rectangle tilted at a 45-degree angle overlays an image

I have a challenge to create a 45-degree rotated square inside a square container, making sure it is responsive. Here's the code I have come up with so far: <div class="container"> <figure> <img src="https://placekitten.com/500 ...

What is the best way to apply CSS hover effects to specific cells within a table?

Is there a way to selectively apply CSS hover effects to only specific cells in a table? And can I disable it on the cells where I don't want it? td:hover { border-style:dotted; border-color:#F60; border-width:medium; border-left-styl ...

What steps should I follow to make a stunning photo collage using HTML, CSS, and Bootstrap?

I attempted to insert images into the div but encountered difficulties. <img class="img-fluid" src="https://via.placeholder.com/800x800" style="border-radius: 20px" ...

Discovering whether a Progressive Web App has already been installed on iOS

I've developed a PWA angular application and I'm looking to prompt the user with a popup asking if they'd like to add the application to their homescreen. However, I only want this notification to appear on IOS Safari, so I've implemen ...

Achieving vertical alignment and stretching of subchild within a flexbox element

I am in the process of creating a mobile navigation menu using Flexbox. It will be a vertical menu that occupies 100% of the available height, with the navigation items evenly spaced and taking up the entire height. The structure I am using is ul>li> ...

Error encountered during ng update process: The workspace root directory is unable to resolve the "@angular-devkit/schematics" package

ng update The error message stating that the "@angular-devkit/schematics" package cannot be found in the workspace root directory suggests a possible issue with the node modules structure. To address this, you can start by deleting bo ...

Need help inserting an image into the div when the ngif condition is true, and when the ngif condition is false

Essentially, I have a situation where I am using an *ngIf condition on a div that also contains an image. This is for a login page where I need to display different versions based on the type of user. However, I'm facing an issue where the image does ...

Developing a customizable Angular application for a diverse range of users

In my current project, I am developing an Angular front-end application that showcases a consistent layout and interface, but with the ability to customize company-specific elements such as logos, colors, and other variables. The main objective is to creat ...