Dividing an interface into four sections with jQuery Mobile

Currently, I am working with jQuery mobile and attempting to divide the page into four sections(Fiddle) with header and footer included. Unfortunately, I am facing some issues with this setup.. Check out my Fiddle here

<!DOCTYPE html>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.2/jquery.mobile-1.1.2.min.css" />
        <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
        <script src="http://code.jquery.com/mobile/1.1.2/jquery.mobile-1.1.2.min.js"></script>
        <link rel="stylesheet" href="app.css"/>
    </head>

    <body>
        <div data-role="page">
            <div data-role="header" data-rel="back">

            </div>

            <div id="div1" class="a"></div>
            <div id="div2" class="a"></div>
            <div id="div3" class="a"></div>
            <div id="div4" class="a"></div>

            <div data-role="footer">
                <h4>Page Footer</h4>
            </div>

        </div>
    </body>

CSS

html, body { height: 100%; padding: 0; margin: 0; }
div.a { width: 50%; height: 50%; float: left; }
#div1 { background: #DDD; }
#div2 { background: #AAA; }
#div3 { background: #777; }
#div4 { background: #444; }

As of now, only the footer is visible, but it's displaying at the top. Any ideas on what might be going wrong with my implementation?

Answer №1

Implement jQM grids layout for optimal design.

Check out the Demo here

<div class="ui-grid-a">
  <div id="div1" class="ui-block-a">A1</div>
  <div id="div2" class="ui-block-b">B1</div>
  <div id="div3" class="ui-block-a">A2</div>
  <div id="div4" class="ui-block-b">B2</div>
</div>

For more information, visit this Grids resource link

Answer №2

Ensure to include height: 100%; in the CSS of your main parent container

view example

In the provided demonstration, deleting the height declaration from the main container will result in malfunction.

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

Is it possible to pass arguments to setTimeout function?

At the current moment, my code looks like this: function showGrowl(lastNumber) { var num = lastNumber; //keep generating a random number untill it is not the same as the lastNumber used while((num = Math.ceil(Math.random() * 3)) == lastNumber); ...

How can I troubleshoot non-functional traffic lights in vue.js?

I've recently built a traffic light using vue.js, but unfortunately, it's not functioning as expected. The colors (red, yellow, and green) are supposed to change according to the time duration, but for some reason, this isn't happening. Can ...

Can CSS achieve a similar blur effect on a background image as seen in video production?

On my website, I have a photo section that displays random user-submitted images. I am facing the same challenge of fitting images into a frame, similar to how landscape video is adapted for broadcast television when combined with portrait cell phone video ...

Remove hidden data upon moving cursor over table rows after a delay

Hey there! I'm in need of a little assistance, so I hope you can lend me a hand. Here's the scenario: Within my category table, there are numerous rows, each containing a hidden textbox with an empty value and a unique ID. As users navigate t ...

What is the reason behind jQuery appending a closing tag to the end of the text when adding a table dynamically?

$('#all_locations').append("<table>"); $('#all_locations').append("<tr><th>City</th></tr>"); $.each(data, function(i, item){ $('#all_locations').append("<tr>"); $('#all_locatio ...

Creating a process to produce a random number and send it directly to an automated email

I'm currently utilizing a form builder from jqueryform.com to construct a registration form. My goal is to have each registered user assigned with a unique account number, which will be a randomly generated 6-digit number. Additionally, I want the pro ...

Switching the navbar state from a regular mode to a collapsed mode can be done manually

I need help with my navbar design: <nav class="navbar fixed-top navbar-expand-sm navbar-light"> <div class="container-fluid"> <button class="navbar-toggler" type="button" data-bs-toggle=&q ...

Retrieve Sol:r JSON data using the $.ajax function

I am encountering difficulties fetching my JSON result from a Solr request, as I keep receiving an error in return. Below is the code snippet: $.ajax({ url: 'http://' + url + '/solr/select', type: 'POST', ...

Prevent form submission by using jQuery's replaceWith method when the input type is a submit button and the onClick event is triggered

Below is the HTML code snippet I am working with: <input class="button" name="save" onclick="$(this).replaceWith('<img src=http://www.example.com/images/ajax-loader.gif />');" type="submit" value="SUBMIT"> After clicking on the butt ...

Tips for saving the quantity of likes from an HTML "icon button"

I recently started exploring web development as a hobby and created a website. I have managed to implement all the features I wanted except for one. Despite researching extensively about databases and Ajax, I have not been able to find a solution that work ...

The CSS overflow hidden attribute is leading to issues with the functionality of the Google Maps API

I am struggling to showcase a Google map as a tooltip using the qTip jQuery plugin. I have multiple elements on my page and need to assign overflow: hidden to all of them. Everything is functioning properly, except for the fact that the Google map toolti ...

Traversing through asp:GridView information with javascript

Is it possible to iterate through the data in an asp:GridView on the Client-side using JavaScript? If so, I would like to understand how this can be achieved... My objective is to extract the values of two fields in the Grid and add an image to each row b ...

Guide on submitting a query to an ASP page through PowerShell

One of the pages on an internal aspx website is http://stackoverflow/answers/Requests.aspx. This page is where data is submitted through forms to retrieve results. I am seeking advice on how to submit the same query/data using PowerShell. Although I am ...

Creating a Personalized Dropdown Menu Within the <div> Tag

My current task involves obtaining an element in the following format: https://i.sstatic.net/uhHkL.png Inside the nav-item, there is a dropdown with a top-centered triangle on it, and the dropdown is positioned at the center. Below is what I have achiev ...

Here are the steps to effectively incorporate CSS classes in a form using Laravel Collective 5.2 framework

Hi there, I am currently working on developing an application and find myself in need of implementing CSS classes to a form using Collective Laravel "5.2.*". The snippet of code that I have at the moment is as follows: {!! Form::model($user, array(&apos ...

Prevent unauthorized AJAX requests from external sources within the Node application

I am looking for a way to prevent AJAX requests from being made outside of my application. I need to ensure that the response is not sent when the AJAX request is initiated from external sources, even if the URL is copied and pasted into a browser. My te ...

Excel's VBa cannot locate the table within the innerHTML of IE

My current dilemma involves attempting to extract a table from a webpage. The issue is that copying the entire page is not feasible due to buttons and dynamic elements causing a memory overload when pasted into Excel. To work around this, I am trying to ex ...

Update image source dynamically using AJAX and jQuery

Within my app, there exists a web page that contains numerous images with dynamically generated source URLs obtained by sending get requests to the rails server. Initially, these images are assigned a default source. Upon loading the page, another request ...

How to Filter, Sort, and Display Distinct Records in an HTML Table with jQuery, JavaScript, and

In the HTML page, there will be a total of 6 tabs labeled A, B, C, D, E, and F along with 2 dropdowns. The expected behavior is as follows: The user will choose a value from the 2 dropdown menus. Based on the selected value, filtering should be applied to ...

Implementing stuck elements in a Collection using React Virtualized

Is there a way to make the content of a cell in a react-virtualized Collection stay fixed to one side while scrolling? I usually achieve this with position:sticky, but it doesn't seem to work for content within a Collection. I'm currently workin ...