Surprising automatic scrolling upon pressing the keydown button in Bootstrap

My webpage appears normal with the Bootstrap framework, but whenever I press the down key, the screen scrolls down and displays unexpected white space due to reaching the end of the background-image sized at 1798px * 1080px.

Please refer to the image: https://i.sstatic.net/Mi2jP.png

Here is the snippet of my code:

HTML:

<body style="background:url(assets/img/back-body-base.jpg); background-repeat:no-repeat; background-size:cover;">              
<div class="container-fluid">
    <div class="row">
        <nav class="col-lg-1" style="background-color:#2C2B2B;padding-bottom: 100%;margin-bottom: -100%;"></nav>
        <div class="col-lg-11" style="overflow: hidden">
            <div class="row">
                <header>
                    <div align="center" class="position-header">
                        <a href="index.html">
                            <div>
                                <img src="assets/img/logo.png" height="25%" width="25%"/>
                            </div>
                            <div class="p-top-10">
                                <img src="assets/img/sublogo.png" width="25%" height="25%"/>
                            </div>
                        </a>
                    </div>
                </header>
            </div>
            <div class="row">
                <div class="col-lg-1"></div>
                <div class="col-lg-11">
                    <div class="p-top-50"></div>
             <div class="row">                                          

                        <div class="col-lg-11">
                            <div class="row">
                                <div id="monday"  class="dayfloat daybutton-first w-200 dayList"    data-type="day"  data-daycount = "1"   tabindex="1">Mondat</div>
... (content continues) ...                   
                    </div>
                </div>                      
            </div>                  
        </div>
    </div>
</div>
</body>

CSS:

.p-top-10 {
    padding-top: 10px;
}
.p-top-30 {
    padding-top: 30px;
}
.p-top-50 {
    padding-top: 50px;
}

Additional Information:

  1. I have implemented a keydown event using jQuery to navigate between <div> elements.
  2. The resolution of 'back-bode-base.jpg' is 1798px*1080px.

Any assistance on this matter would be greatly appreciated. Please help!

Answer №1

To achieve a full-width fixed background, apply the following CSS code:

body {
    background: url(./images/background.jpg) no-repeat;
    background-size: cover;
    background-attachment: fixed;
}

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

Using AJAX to make PHP function calls results in the page being refreshed each time

Currently, I am in the process of constructing a new script that requires incorporating a PHP function to send an email. My approach involves nesting a couple of Ajax calls within a JavaScript function. However, every time this function is called, it simpl ...

Changing the text during a reset process

I've been grappling with this issue, but it seems to slip through my fingers every time. I can't quite put my finger on what's missing. My project involves clicking an image to trigger a translate effect and display a text description. The ...

Tips for executing and triggering the same function concurrently from various `<LI>` elements

Is there a way to execute the same function concurrently from multiple <LI> elements using javascript or jQuery? I am looking to utilize the same function with varying parameters to create a tabbed browsing experience. I want multiple tabs to load a ...

What are the steps to modify data within the root component?

I am currently working on a Vue project with vue-cli and routes. In my App.vue file, the template structure is as follows: <template> <div id="app"> {{Main}} <router-view></router-view> </div> </template&g ...

AngularJS - varying actions based on which input field I interacted with first

Here is the tutorial I referenced for this code: <!DOCTYPE html> <html> <head> <title>AngularJS Tutorials</title> <link rel="stylesheet" href="vendor/foundation/foundation.min.css"> </head> <body> & ...

Altering the input type of a cloned element in Internet Explorer results in the loss of the value

When I have checkbox inputs displayed in a modal with preset value attributes, upon clicking "OK", I clone them and change their input types to hidden, then append them to a div in the document body. However, when trying to retrieve their values using jQue ...

Increasing the grid size in React Bootstrap 5 for added flexibility

Customizing React Bootstrap Sizes WPW Container Max-Width sx < 576px - none sm > 567px - 540px md > 768px - 720px lg > 992px - 960px xl > 1200px - 1140px xxl > 1400px - 1320px Desiring a New Size Category: I am interested in ad ...

Display Text Aligned in the Middle Beside Website's Logo

Newbie to HTML and CSS here! I'm attempting to achieve a design similar to this: Below is my code snippet: <div id="topbar"> <div class="image"> <img src="images/ghwlogo.png"> </div> <div class="text ...

Eliminate Elements from Array - Angular Four

I am currently developing a basic to-do app using Angular4. The setup of the app is structured as follows: Form Component: Responsible for adding items to the to-do list Item Component: Represents individual to-do items App Component: Contains a *ngFo ...

When utilizing React client-side rendered components, the state may fail to update while the script is actively running

I am currently facing an issue for which I don't have a reproducible example, but let me explain what I'm trying to do: class MyComponent extends Component { constructor(props) { super(props); this.state = {}; } componentDidMount() ...

Creating a seamless full-page grid layout with CSS to eliminate the need for scrolling

My goal is to have 20 items on the grid of this page, each taking up full width and height with a fluid layout. Currently, I have successfully set up the page with 20 items spanning full width in a fluid design. However, the content of the grid is being p ...

Load data into Handsontable using AJAX when the site is freshly loaded

Could you please clarify the reason behind the functionality of this code: $(document).ready(function () { var container = document.getElementById('example'); function fetchData() { var dataResult = null; $.ajax({ ...

Tips for switching a group of buttons within a userscript by clicking a single button?

Apologies if my wording is not clear, allow me to clarify. I am in the process of developing a userscript that will display a set of buttons below a main button when clicked. These additional buttons will serve different functions and should disappear whe ...

Determining when a message has been ignored using php

One of the features I am working on for my app is adding announcements, which are essentially personalized messages to users. Once a user receives a message and dismisses it, I want to ensure that specific message does not appear again. Here is the PHP co ...

Leverage the power of integrating Power BI with Javascript to easily retrieve an

I have embarked on a mission to integrate PowerBI into my web application. Below is the code snippet that I have implemented: window.config = { instance: 'https://login.microsoftonline.com/', tenant: 'common', //COMMON OR YOU ...

Inserting images into an HTML table using JavaScript in real-time

I am attempting to dynamically add an image into a table, but I am encountering difficulties. Whenever I try to insert an image into a cell, I receive the following error message: Cannot access the inner content because it is not literal. if ...

Update the URL and parse the data in a Backbone collection

For the purpose of development, I am looking to replace the collection with fake JSON results either from a JSON variable or a JSON file. However, I encountered an error when attempting to do so using url http://jsfiddle.net/qhoc/uZhM8/ GET http://fiddle ...

Can the color scheme be customized for both light and dark themes in Ant Design version 5?

After creating a hook that successfully toggles between light and dark modes in Chrome's Rendering panel, I noticed that the values in the ConfigProvider remain unchanged when switching themes. Can anyone suggest a workaround to modify the design toke ...

Is it possible to write a text file in UTF-16 using Javascript?

I need to create a UTF-16 text file from a string. For instance: var s = "aosjdfkzlzkdoaslckjznx"; var file = "data:text/plain;base64," + btoa(s); The above code generates a UTF-8 encoding text file. How can I modify it to produce a UTF-16 text file usin ...

Ways to display console.log output in VS Code?

Sorry if this question is a bit unclear, but I'm struggling to figure out how to display the results from my console.log (line 14) in the console/terminal. I want to see the random RGB values generated for each column every time I click the button, bu ...