Resizing the background image alters the perspective on Android devices

I'm currently developing an ionic3 application and everything is running smoothly, except for one issue. Whenever the keyboard is used in inputs or when the inputs are focused, the background image resizes, creating a less than ideal view. After searching extensively online, I came across similar questions on forums, but unfortunately, the solutions provided didn't work for me in the context of ionic3.

Dealing with image resizing in Ionic. Resizing images in Ionic due to keyboard interactions Now, I will share some of the code snippets related to this issue.

<ion-header>
  <ion-navbar>
    <ion-title>
      Login
    </ion-title>
  </ion-navbar>
</ion-header>
<ion-content>
  <div class="login">
    <div class="login-form">
      <ion-grid>
        <ion-row>
          <ion-col col-sm-12>
            <ion-list inset>
              <ion-item>
                <ion-label ionitron-bot>
                  <ion-icon name="person"></ion-icon>
                </ion-label>
                <ion-input
                  [(ngModel)]="phone"
                  type="tel"
                  placeholder="Enter your phone number"
                ></ion-input>
              </ion-item>
            </ion-list>
          </ion-col>
        </ion-row>
        <ion-row>
          <ion-col col-sm-12></ion-col>
        </ion-row>
      </ion-grid>
    </div>
  </div>
</ion-content>
**

SCSS style codes.

page-new-user {
    ion-content{
        height: 100%;
    }
  div.login {
    width: 100%;
    height: 100%;
    background: url("../../../assets/imgs/bg-01.jpg") no-repeat;
    background-size: cover;
    background-position: 100% 100%;
    height: 100%;
    div.login-form {
      width: 50%;
      height: auto;
      margin: auto;
      background-color: #ddd;
    }
  }
}

Furthermore, I will be sharing screenshots of the application.

Before input focus After input focus

Answer №1

 ion-content{
        height: 100%;
        .scroll-content{
            padding-bottom: 0px !important;
        }
    }
  div.login {
    width: 100%;
    height: 100%;
    background: url("../../../assets/imgs/bg-01.jpg") no-repeat;
    background-size: cover;
    background-position: 100% 100%;
    height: 100%;
    div.login-form {
      width: 50%;
      height: auto;
      margin: auto;
      background-color: #ddd;
    }
  }

Adding

.scroll-content{padding-bottom: 0px !important;}
to the ion-content section resolves an issue with the ion-scoll component changing its padding.

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

Square Power Box

I have been attempting to create two equal sections, one displaying an image and the other showing text, both maintaining a square shape with identical width and height. I am using the Avada theme on Wordpress along with Element Builder and custom CSS to a ...

"Occasionally, the PHP function for randomly selecting an image may result in

My function is supposed to open a specific directory, create an array of the image files within that directory, and then select a random image from the array to display on a webpage. However, there are instances where it fails to retrieve the image name. ...

Secure your online file with a password

I need to access a specific file on my computer through a program, not a web browser. However, I want to ensure that only authorized users can view the file by requiring a password with the request. How can I set up the file to prompt for a password befor ...

Having trouble creating two bar charts with different data sets in ng2-charts using Angular 8

I attempted to display two charts simultaneously on a single page by utilizing the following code in HTTP: <div class="chk-block-content"> <canvas height="100" width="500" baseChart [datasets]="barChartData" [labels]="barChartLabels" [options ...

Turn only one bracket on the accordion

When clicking on a specific header, I want only one chevron to rotate instead of all the chevrons rotating. I am currently unsure how to specify which chevron should rotate individually. My project is in ASP.NET MVC 5 and I am using razor view to loop th ...

The current inquiry does not conform to the MultipartHttpServletRequest format

I've been encountering an error while trying to send both an image and an object from Angular to Spring Boot. The error message I keep receiving is: Current request is not of type [org.springframework.web.multipart.MultipartHttpServletRequest] Below ...

"Enhance your website with a dynamic hover effect and striking letter spacing in

In the div below, there is a span with the following code: <div class="mission-button"><span class="mission">view our mission</span></div> Accompanied by this CSS: .mission-button::before { content:'&ap ...

Find the value of the nearest input field using jQuery

I'm working with HTML code that looks like this: <tr> <td class='qty'><input class='narrow' value='1' /><i class='fa fa-trash' aria-hidden='true'></i></td> < ...

As the width decreases in animation, the content gradually disappears until it reaches zero

My issue involves red and black divs; when I hover over the parent element, the red div should appear by expanding to its full width. However, a problem arises when the width is set to 0px as the content still shows. Can someone provide assistance on how t ...

If the desktop website is zoomed in beyond 150%, it will automatically switch to mobile responsive mode

Whenever the desktop website is zoomed above 150%, it automatically switches to mobile responsive mode. Is there a way to disable this feature? You can find the website in question here: Give it a try by zooming to 150 percent and see for yourself. Appr ...

What is the most effective method for declaring a constant within a WebComponent?

After receiving questions, I included more details on how I'm utilizing the constants. The main issue I am encountering is that the constants are being added to the global object, which raises concerns about potential name collisions. I created a Web ...

The Console.Log function will not run if it is placed within the RXJS Tap operator

In my current setup, I have the following observables: this.authenticationService.isSignedIn() -> Observable<Boolean> this.user$ -> Observable<UserModel> I am in need of checking a condition based on both these observables, so I attempt ...

Adjusting the height of table rows based on the content within the <td> element

I am facing a challenge with a table that includes rows with 2 columns - one for images and the other for text. The issue arises when resizing large images in one column, causing the row to take its height from the image cell rather than the text cell. Sin ...

Can you tell me the meaning of NGX and how it is commonly utilized?

Can you explain NGX to me? I frequently come across it paired with module names in Angular applications. What exactly is NGX and what purpose does it serve? ...

Ways to receive notification during the user's selection of an option by hovering over it

Is there a way to receive an event when a user hovers over a select option? I thought that using the onMouseOver or onDragOver props on the option component would work, but it seems like they only trigger for the parent select component. Below is a simpli ...

Input form sending information to an incorrect destination URL

I'm struggling to get my form to pass a parameter to a link in the desired format: index.php?action=2&parameter=value Currently, it is only passing the parameter like this: index.php?parameter=value Here's the code I have been using : &l ...

What is the command to activate watch mode using ngc?

In the past, using the old tsc method, I could simply call tsc -w and any changed files would be recompiled on the fly. However, with ngc, it seems that the -w flag doesn't have any effect and there is a lack of documentation on its command line argu ...

Transforming color images into black and white using JavaScript

     I have implemented this code to convert colored images to grayscale. function applyGrayscaleEffect() {         var imageData = contextSrc.getImageData(0, 0, width, height);         var data = imageData.data;         var p1 = 0.99;   ...

Tips for configuring a file using javascript and angular.js

I am in need of some assistance. I would like to create a configuration file that stores all the paths for JavaScript files, which can then be dynamically called and included in the index page using Angular.js or JavaScript. The structure of my files is ex ...

Can you share any simple methods for utilizing a JavaScript game engine?

Looking to take on a school project involving creating a bomberman-like game in JavaScript for person versus person online gaming. I have the freedom to use any open-source library or framework. However, mastering JavaScript from scratch seems quite daunt ...