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:

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

The Material UI Elements are not displaying properly as expected. Instead of seeing the MUI elements, a tan box is appearing. What steps can I take to resolve this

I'm currently using Material UI to build a basic header, footer, and profile page. However, whenever I attempt to display any type of element (such as Menu, Appbar, Toolbar, IconButton, Tab, Tabs, etc.), the page only shows a tan box instead of the a ...

jQuery Extends the loop with the picture

I currently have an animation that goes from the bottom to the top but I want it to loop smoothly without abruptly starting over. Is there any way to achieve this? JavaScript Code var ticker = $('#ticker'); var container = $('#ticker > ...

Ensure the function has completed setting state before proceeding to the next function

async componentDidMount() { this.loadSelectors(); this.useSelectors(); }; loadSelectors = () => { this.setState({"Selector": "Test"}); } useSelectors = () => { console.log(this.state.Selector); } Is there a way to ensure that loadS ...

What folder layout is best suited for organizing Protractor end-to-end test cases?

Is it best practice to maintain the folder structure for e2e test cases in Protractor identical to that of the application? ...

The setStyle() method in JavaFX is like CSS Selectors

Is it possible to bind CSS files to style JavaFX components and also change properties dynamically in code? I'm struggling with the setStyle() method as there's limited documentation available on how to use it effectively. Instead of modifying t ...

When using html-pdf-chrome to print to an A4 PDF, there appears to be a significant space below the A

In my Laravel project, I am currently utilizing the westy92 / html-pdf-chrome library to convert HTML to PDF. The front-end of my project is based on React. I have defined a series of divs to act as A4 pages: <div id="pdf" className="pri ...

Replacing text within a paragraph using D3.js

Is it possible to develop a D3 function that can choose a paragraph, delete its content, and replace it with new text? If so, what would be the most effective way to accomplish this? I attempted the following: d3.select("#triggerButton") .on("clic ...

Using JQuery to dynamically add items to an ASP.NET Repeater on the client-side

Here is the repeater code that I am working with: <asp:Repeater ID="_List" runat="server" DataSource="<%# GetList() %>"> <HeaderTemplate> <table class="dataList"> <tr> <th>Name</th> </tr> ...

Request successful but receiving no response text and content length is zero

let req = new XMLHttpRequest(); req.addEventListener('load', function (data) { console.log(data) }, false); req.open("get", "/bar.txt", true); req.send(); Feeling a bit perplexed at the moment, I can't seem to figure out what's going ...

Utilizing PHP and Ajax to showcase individual row details within a while loop upon clicking a hyperlink

In the midst of a new project, I find myself faced with a task where the user can log in and view their personal delivery orders. The list of deliveries is generated using a while loop. However, whenever I click on the details button for an item in the lis ...

Creating dynamic axes and series in Ext JS 4 on the fly

I am looking to dynamically generate the Y axis based on a JSON response. For example: { "totalCount":"4", "data":[ {"asOfDate":"12-JAN-14","eventA":"575","eventB":"16","eventC":"13",...}, {"asOfDate":"13-JAN-14","eventA":"234","eventB":"46","even ...

Having trouble removing a row from Mysql database using Node.js

Recently, I developed a pet shop web application using nodeJS and MySql. Everything was working smoothly until I encountered an issue with deleting pets by their pet_id. Upon attempting to delete using pet_id 'pa04', I received the following erro ...

Converting the stage object to JSON format and incorporating it into an HTML5 environment using

$("#show").click(function(){ var stage = Kinetic.Node.create(json, 'container2'); var ball = new Image(); var cone = new Image(); var tshirt = new Image(); ball.onload = function() { stage.get('.ball').apply ...

tips for navigating through an AngularJS $resource instance

I am facing a frustrating issue that I need assistance with. The problem arises when I try to extract specific data from each element of the stock data fetched by my controller from Yahoo Stocks. Although the data is stored in $scope.stocks and can be disp ...

The functionality of the JQuery $.post method may be compatible with Firefox but may encounter issues when

I've encountered an issue with my website where certain functions that update the database using $.post work perfectly in Firefox, but fail to function properly in Internet Explorer. I'm struggling to identify the root cause of this problem. Here ...

Adding CSS files to a JSP page in a Struts2 application

Hello, I am currently learning Java and working on a Struts2 project. I have added a stylesheet in the following path: /WEB-INF/common/css/style.css and also included Bootstrap in this directory: /WEB-INF/common/css/bootstrap/bootstrap.min.css I ...

Is the Ajax call being triggered unexpectedly?

I've been working on an Ecommerce website and everything was going smoothly until the update_cart (quantity) code started submitting my form instead of updating it. I've tried making changes and even moving it outside the form, but the issue rema ...

Can the <container> block be positioned beneath the <header> block?

header { background: blue; color: white; width: 100%; } .container { background: green; text-align: center; width: 100%; height: 100px; transform: skew(0, -10deg); color: white; position: relative; top: 55px; } .container .home{ p ...

There was an unforeseen conclusion to the JSON input while attempting to parse it

I am having an issue with the code in my get method. Can someone please help me troubleshoot and provide some guidance on how to solve it? app.get("/",function(req,res) { const url = "https://jsonplaceholder.typicode.com/users" ...

What is the sequence of the middlewares for error handling and handling of 404 errors?

The express.js website has confused me with contradictory statements regarding error-handling middleware. According to one page, you should define error-handling middleware last, after other app.use() and routes calls. However, another page states that you ...