Why does one part of my Django website appear less appealing on a smartphone compared to the rest?

Looking for some advice for my django website. I recently deployed it on heroku and it seems to be working well, except for the "final view" on smartphones. Everything looks good on PC, but on mobile devices, there is a slight horizontal and vertical scroll.

I suspect this is due to using the "zoom" CSS functions on my images to align them how I wanted. However, I only used zoom to make small images bigger, not the other way around, so it should technically be fine, right?

Is there a way to fix this without disrupting the rest of my work? I came across this StackOverflow thread: DISABLE the Horizontal Scroll. But trying to counter user scrolling with JavaScript as a plan B or C doesn't sound too appealing...

Here are some screenshots illustrating the issue:

https://i.sstatic.net/rE5IQ.jpg https://i.sstatic.net/0oDyI.jpg

Below is the template for this page:

{% extends "builder/base.html" %}
{% load static %}

{% block content %}

<!DOCTYPE html>
... (omitted for brevity) ...

    <!--Javascript that I used for making cloud from before disappear after given amount of ms. Opacity from 1 to 0.-->
    <script>
function displayOut() {
    var a = document.getElementById('id_cloud_1');
    setTimeout(function(){
        a.style.opacity='0';
    }, 200);
    var b = document.getElementById('id_cloud_2');
    setTimeout(function(){
        b.style.opacity='0';
    }, 300);
    var c = document.getElementById('id_cloud_3');
    setTimeout(function(){
        c.style.opacity='0';
    }, 400);
}
displayOut();
    </script>
</div>

</body>
</html>

{% endblock %}

Any help would be greatly appreciated! Thanks!

Answer №1

To solve the horizontal scrolling problem, simply add this to your css file: set body to width: 100vw and overflow-x: hidden

That should resolve the issue without requiring any JavaScript intervention!

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

Switch the angular attribute by clicking on ng-click

I have a Google Map set up with markers that I need to switch on and off. <marker id='{{marker.id}} 'visible="{{ condition ? 'true' : 'false'}}"> </marker> Additionally, I have created a button to control the v ...

Creating a custom Chrome extension with CSS embedded within an iframe

Recently, I developed a Chrome app that includes an iframe element within it. <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="v ...

kombu.exceptions.SerializeError: Unable to serialize user data in JSON format

I am currently working with a Django 1.11.5 application and Celery 4.1.0, but I keep encountering the following error: kombu.exceptions.EncodeError: <User: testuser> is not JSON serializable Here are my settings in settings.py: CELERY_BROKER_URL = ...

What are the steps required to play a YouTube video using Selenium WebDriver?

In my Python script, I am trying to play/pause a YouTube video using driver.find_element_by_name("body").send_keys('keys.SPACE'), but it doesn't seem to work. Is there any alternative method I can use? Since the Selenium method is ...

Stopping Django from creating tables during migrations on read-only databases

I have integrated my Django application with a legacy database. The user I used to connect to the database only has read access, which limits the ability to make changes through the Django shell. However, an issue arose after running the migration in Djan ...

Align and resize image using CSS styling

Seeking assistance on centering and cropping images using CSS. Tried implementing the technique from this specific article. However, experiencing inconsistencies in device UI output. Can someone shed light on this behavior? Scenario: The objective is t ...

Importing data from a CSV file into an HTML table through JavaScript

I am working on creating a webpage that can load a selected CSV file from the hard drive and then display its contents using HTML tables. My project involves two main components, and I have been focusing on the second component. This part deals with gener ...

What is the best way to make a ContentPlaceHolder in ASP.NET expand to cover the entire page?

I am facing an issue with my Master page and some of the pages that use it. Despite having insufficient content on one or two pages, the footer ends up appearing near the middle of the screen and the background becomes visible at the bottom. I am looking f ...

Display of items in a submenu through a drop-down menu when hovering over it

As I work on creating a Navbar with a dropdown menu, I'm encountering an issue where hovering over the main list element displays all the submenu contents at once. No matter what I try in my CSS, including adjusting the positioning of li and ul elemen ...

Python-JavaScript Integration Problem

I'm a beginner when it comes to Javascript, Python, and PHP. In my Javascript program, I have a button that triggers a Python script and displays the returned value on the screen. My goal is to steer clear of using Jquery and Json. Here are the snipp ...

`How can I use JavaScript to display a modal?`

I am currently a student immersing myself in the world of coding, particularly focusing on learning javascript/jquery. In my recent project, I have developed a chess game using RoR and now I am tackling the promotion move. The idea is that when a Pawn piec ...

Tips for adding a texture to THREE.ExtrudeGeometry

const circleShape = new THREE.Shape(); circleShape.moveTo( 50, 10 ); circleShape.absarc( 10, 10, 40, 0, Math.PI*2, false ); const textureMap = new THREE.ImageUtils.loadTexture('moon.jpg'); const shapeGeometry = new THREE.ExtrudeGeometry(circleSh ...

What is the best way to assign a percentage width based on a variable in jQuery?

Is there a way to assign a dynamic width value to an element? Here is the code I am using: $(".menu_list_item").css({ width: width + "%" }); Unfortunately, this doesn't appear to be functioning correctly. If anyo ...

Step-by-step guide on displaying products with server-stored images in an Android app

Currently, I am utilizing AsyncTask to retrieve a list of products in JSON format, which contains product names, prices, and image paths. These images are hosted on a web server. As I loop through the JSON Array, I aim to construct a layout that consists o ...

Complete visibility of Bootstrap progress labels is compromised

Progress bar with a customized label inside: <div id="progress" class="progress mb-1" style="height: 20px;"> <div class="progress-bar" role="progressbar" style="width: 5.0%" aria-valu ...

Issue with PHP header not redirecting after form submission page

When the form is submitted, the user is directed to an action page where an email is sent with an attachment. Although I am receiving the email and attachment successfully, the header('Location: ...') function seems to be malfunctioning. The act ...

What is the method to achieve a full-width image when utilizing vertical scrollspy within Bootstrap?

Seeking a unique responsive webpage design utilizing Bootstrap. I envision a vertical scrollspy on the left paired with parallax scrolling on the right, akin to this example. Here's my current code snippet: <!DOCTYPE html> <html> <he ...

Modify the background color of each word within the search bar

I've been attempting to colorize each word using jQuery and give them a colored background. I came across a solution, but it only seems to work for the HTML content, not the input field in the search bar. Below is an example of what I found: HTML So ...

What is the best way to transfer floating point input values from one page to another for later retrieval?

Is there a way to send floating point values to another page? I tried sending a floating point value in an AJAX request, but the receiving page only gets an integer value. <div class="form-group"> <label for="" class="col-sm-4 control-label"> ...

Ways to include numerous entities obtained from a JSON object

I am facing an issue with my code involving two array lists. I am attempting to add multiple objects of the same type to one array list, but when I try to retrieve them from the array list, only the most recently added object is being returned. Below is t ...