Height Responsive Digital Signage

I recently created a weather page that functions well in landscape mode, but I am facing challenges getting it to work smoothly in portrait mode. Currently, the page is only optimized for normal screens.

Here's the script I've developed using bootstrap:

<div class="col-md-12 col-sm-12">
    <div class="col-md-1 col-sm-1"></div>
        <?php

            foreach ($xml->forecast->time as $day) {

                $dt = strtotime($day['day']);
                echo 
                '<div class="col-md-2 col-sm-2" style="min-height: 80vh; float: left;">
                    <div class="col-md-12 col-xs-12 col-sm-12">
                        <h3 style="font-size: 2.7vw; text-align: center;"><a href="#">' . date("l", $dt) . '</a></h3>
                    </div>
                    <div class="col-md-12 col-xs-12 col-sm-12">
                        <img src="images/' . $day->symbol['var'] . '.png" alt="icon" style="max-width: 90%;">
                    </div>
                    <div class="col-md-12 col-xs-12 col-sm-12" style="margin-top: 15px;">
                        <h1 style="font-size: 10vh; float: left;">' . floor($day->temperature['day']) . '&deg;</h1>
                        <br>
                        <h5 style="font-size: 5vh; float: right; margin-top: 10vh;"> ' . floor($day->temperature['min']) . '&deg;</h5>
                    </div>
                </div>';

            }

        ?>       
    <div class="col-md-1 col-sm-1"></div>    
</div> 

The issue arises when viewing this on an Android Xibo player in portrait mode:

I aim to have a similar layout to the landscape version where each day is displayed without the need for scrolling. The main challenge I'm encountering is adjusting the height of the content appropriately for optimal display. Both images within the page are in full HD resolution.

Answer №1

After two days of hard work, I finally managed to get it up and running!

To ensure text responsiveness, I implemented the following script:

<script>
        $(document).ready(function () {
            if (window.innerHeight > window.innerWidth) {
                $(".day").css("font-size", "2.5vw");
                $(".first_temp").css("font-size", "5vw");
                $(".second_temp").css("font-size", "5vw");

            }
            else {
                $(".day").css("font-size", "4vh");
                $(".first_temp").css("font-size", "6vh");
                $(".second_temp").css("font-size", "4vh");
            }
        });

    </script>

I also made modifications to the script like this:

<div class="col-md-12 col-sm-12 col-xs-12">
            <div class="col-md-1 col-sm-1 col-xs-1"></div>
            <?php
            foreach ($xml->forecast->time as $day) {
                $dt = strtotime($day['day']);
                echo '<div class="col-md-2 col-sm-2 col-xs-2" style="min-height: 80vh; text-align:center;">
                        <h3 class="day" style="color: white; width: 100%; margin: 0 auto;><a href="#">' . date("l", $dt) . '</a></h3>
                        <img class"image" src="images/' . $day->symbol['var'] . '.png"  alt="icon" style="width: 3vh; min-width: 90%;  width: 100%;margin: 0 auto;">
                        <h1 class="first_temp" style="font-size: 3vw;  width: 100%;margin: 0 auto;">' . floor($day->temperature['day']) . '&deg;</h1><br>
                        <h5 class="second_temp" style="font-size: 1.5vw;margin-top: 10vw;  width: 100%;margin: 0 auto;"> ' . floor($day->temperature['min']) . '&deg;</h5>
                      </div>';
                }
            ?>      
            <div class="col-md-1 col-sm-1 col-xs-1"></div> 
        </div>

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

Issue with the top margin of the body

Recently, I've encountered a peculiar problem with a standard website layout that I use. The issue seems to be centered around the space between the top and the first div: navbar. No matter what I try, I just can't seem to remove it, as the reas ...

Issues with Google Fonts displaying poorly on Chrome

While working on my project, I've encountered an issue with the rendering of Source Sans Pro from Google Fonts in Chrome. Sometimes the font completely breaks, and unfortunately, I haven't been able to pinpoint when or why this occurs. At times, ...

App crash alert: Xamarin Android has encountered a stoppage

Currently, I am utilizing Xamarin Android to create an Android Application. In my development process, I am attempting to capture global exceptions using the following code: AndroidEnvironment.UnhandledExceptionRaiser += (sender, args) =>        ...

"Enhancing Your Website Navigation with jQuery: Incorporating Mouse Events into Your Menu

My objective is to create a simple mouseover effect on my menu that remains active while the mouse is in a submenu, and triggers the close() function when the mouse leaves the main tab or the submenu. I understand that an event handler is required to trig ...

The error message "noclassdeferror occurred for inner class MyLicenseCheckerCallback" indicates

Recently, I've been following this tutorial step by step. However, I keep encountering the following error: 08-21 14:12:49.599: E/AndroidRuntime(714): java.lang.NoClassDefFoundError: com.akiraapps.LicenseCheck$MyLicenseCheckerCallback import ...

Achieving a seamless integration of a navbar and video in Bootstrap 5.3: tips and tricks

I'm updating a website design using Bootstrap and I want to create a navbar with a video playing in the background. To ensure that the navbar stays fixed at the top while scrolling, I made it sticky. After testing various methods, I managed to posit ...

Turn off the Android keyboard

While attempting to input text into an EditText field on the emulator, I am unable to use the computer's keyboard and the onscreen keyboard keeps appearing. Is there a method to prevent the onscreen keyboard from popping up and allow typing using the ...

Focusing on a specific input category inside a div container

Struggling to customize the appearance of the last input type within the Jetpack plugin in WordPress. I have experimented with the following CSS: #subscribe-submit > input[type="submit"]::last-of-type { #subscribe-submit > input[type="submit"]:nth- ...

Can flex-basis be used with percentage in IE11?

Encountering an issue with flexbox and IE10/11. Trying to utilize min-width/max-width values, but IE11 is not cooperating. Discovered flex-basis and used a percentage value, which functions as intended in Chrome but fails in IE11. Experimented with adding ...

Tips for enlarging an image element without causing the header to expand

I'm looking to enhance a logo image within a header element by expanding it on hover or creating a pulse effect. I thought of increasing the max-width and adding a transition for simplicity. However, my main concern is how to make only the img element ...

What happened to all the different editions of the recyclerview?

Adding a recyclerview to Android projects requires the inclusion of compile 'com.android.support:recyclerview-v7:26.0.2'. I am curious about where Gradle finds the recyclerview package. Is there a way to access previous versions of recyclerview ...

iOS alternative to Android's colors.xml file

As I work on developing an app that has multiple brandings sharing a common codebase, I utilize XML files in my Android project to define colors for each branding. The views in the app then utilize these color codes from the XML files rather than hard-codi ...

Orientation of photos with Adobe AIR CameraUI

Encountering difficulties on certain Android devices when attempting to capture a photo with the CameraUI class. Even though my AIR app is set to portrait only with autoOrients = false, photos taken in portrait orientation appear rotated 90 degrees to the ...

Is Jsoup receiving the HTML incorrectly?

Currently, I am utilizing Jsoup to fetch HTML data from a website and attempting to display it in a ListView within my app. Although the application compiles without any errors, clicking the button results in an empty ListView. In my opinion, this issue ...

Ensure that the Bootstrap 5 modal and backdrop are sized to fit the parent container's width and height rather than filling the entire screen

Is there a way to limit the size of a Bootstrap 5 modal dialog and backdrop? The example below occupies 100% of the screen, can it be adjusted to cover only the parent main container? <main class="container-fluid pt-4 px-4" style="height ...

Utilizing various libraries with varying SDK versions in Android Studio

Currently, there are multiple questions posed without any suitable answers. Within my Android Studio project, I have incorporated several libraries that possess varying versions. As a consequence, I am encountering an error when attempting to run the proje ...

Struggling to style a nested table using CSS

Please take a look at this JSFiddle example for reference. I am currently working with tablesort and its associated CSS to achieve alternating row colors for the rows containing first and last names. Additionally, I want the rows within the sub-table disp ...

What's the best way to position my hamburger menu in CSS while ensuring it remains functional?

Having created a website with HTML and CSS, I have successfully implemented various effects such as parallax scrolling and a transparent navbar. However, I am currently facing an issue with making my Navbar responsive. Despite all the elements working prop ...

The navigation bar is failing to redirect to another page upon clicking in Bootstrap 5

The problem arises when attempting to navigate with the navbar item, as it fails to redirect to the intended page and provides no feedback. However, upon removing the bootstrap.bundle.min.js, the redirect feature operates as expected. Nonetheless, the coll ...

There is no element available to input text using send_keys in Selenium

Currently learning about selenium, please pardon any errors. Thank you :) I am trying to scrape a website that allows users to create blogs on 'tistory' using selenium. In order to publish an article, I need to choose between default mode, mark ...