Overflowing multiple divs in CSS

I have a unique situation where I have 10 divs aligned in a row within one container located in the footer of a responsive website. The website is designed to be functional on smartphones as well.

My goal is to create a horizontal scrollview specifically for smartphones, with additional divs which overflow (divs 4, 5, 6, 7, 8, 9, and 10) placed outside the viewport. These overflow divs should slide into view when needed. Currently, using the CSS provided in this jsFiddle, the extra divs that don't fit in the row are displayed below the viewport rather than being aligned in the same row. How can I ensure all divs are in the same row?

In essence, I am aiming for only n squares to be visible within the viewport, while the remaining ones can be slid into view as necessary.

P.S. I am attempting to tackle this issue manually, but I'm curious if there are any jQuery scroll viewer plugins available (excluding jQuery Mobile).

Answer №1

You may want to consider adding another enclosing div for this. Many sliders typically include a div with the CSS property overflow: hidden, containing a wide inner div (wide enough to accommodate all content) that shifts positions when the slider moves. In terms of plugins, I have experience using jQuery Tools on multiple occasions.

Answer №2

Is this the example you are looking for?

HTML

    <body>
        Content
        <div class="footer">
            <div class="footer_contents">
                    <div class="square selected">1</div>
                    <div class="square">2</div>
                    <div class="square">3</div>
                    <div class="square">4</div>
                    <div class="square">5</div>
                    <div class="square">6</div>
                    <div class="square">7</div>
                    <div class="square">8</div>
                    <div class="square">9</div>
                    <div class="square">10</div>
            </div>
        </div>
    </body>

CSS

.footer {
    height:50px; 
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    overflow: scroll;
    overflow-y: hidden;
}   

.footer_contents {
    height: 50px;
    width: 1000px;
    margin: auto;
}

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

Replace the submit button with an AJAX function to provide immediate feedback on user input

I am looking to enhance the user experience by utilizing a dynamic AJAX function to instantly provide the Russian word for a number input, rather than relying on a submit button for this form. Thank you! Thanks to @user1978142, the functionality is worki ...

Could someone provide a detailed explanation on the functionality of multiple inline nth-child() in CSS?

In this scenario, there is an example provided: html>body>#wrapper>div>div>div:nth-child(1)>div:nth-child(1)>nav { I am curious about the functionality of this code. Could someone dissect each div, ">", and nth-child()? Your ins ...

Accessing the value of a hidden field within an ng-repeat loop when binding to an HTML table

I am working on a project where I have an HTML table with data being bound from AngularJS. The structure looks something like this: <tr ng-repeat="item in List| filter: { MachineType: 'Physical' }"> <td>{{item.MachineType}}< ...

Why is my AJAX request not working in conjunction with my on-page JavaScript?

While working on an order confirmation page, I encountered a challenge with an AJAX request that I am making to a page containing JavaScript code for tracking cookies and recording data. Unfortunately, when the request is fired to this other page with the ...

An error in syntax is being triggered by the Php file being accessed through the <script src="list.php"></script>

We're facing an unusual problem with our online ordering platform script that we purchased a few months ago. It had been functioning perfectly for several months, but now we're encountering an issue! The website page is not loading, and when we c ...

I'm having trouble with the live sass compiler plugin in vs code - it's not syncing up with my css file properly

click here for image description I am facing an issue where my CSS file is not translating the codes in my SCSS file properly and adding unwanted comment lines. If anyone has insights on why this might be happening, I would greatly appreciate it. ...

Cache Property: Unable to Retrieve Request in Current Context

After scouring all similar posts about the error message "Request is Not Available in This Context" on SO, it appears that my situation stands out. In our application, many pages inherit from a "base page" class (referred to as BP2) which itself inherits ...

It appears that jQuery is unable to identify a different string when making an Ajax call with a status code of 403

I've encountered a curious situation that has left me wondering if the error lies with me or jQuery. I'm seeking some advice on this matter. Currently, I am making an Ajax call that returns a 403 status code. However, the accompanying message fo ...

Having difficulty generating a footer for a page that includes a Material-UI Drawer component

Looking to create a standard full-width footer at the bottom of my page, I need help with the implementation. Utilizing the "Permanent drawer" from Material-UI Drawer for reference here. If you're interested in experimenting with it, CodeSandbox link ...

Utilizing HTML form action to link to a PHP script located in a separate folder

My journey begins here Main: Members/name.html search.php Members is a directory containing my html code in name.html <form action="../search.php" method="get"> <div> &l ...

Creating interactive button elements in daily views with FullCalendar and Vue3

For the screen design, I have opted to go with Vuejs and specifically using the FullCalendar library https://i.sstatic.net/pn4ic.png The FullCalendar component has been successfully added. I am facing difficulties in rendering a button with DaycellConte ...

Styling Your HTML Background with CSS and Enhancing it with JavaScript

I am lost when it comes to understanding the design of I have spent hours researching how to create backgrounds using shapes and css, but I haven't been successful. Can someone please help me figure out how to create a background similar to . Thank ...

Label embedded within field giving it a crispy touch

Utilizing Bootstrap5, Django, and Crispy Forms to develop a custom calculator application. The app is functioning as intended, but I am looking to modify the appearance of the forms. I've successfully eliminated the required field asterisk by includi ...

Trouble with ajax call in Internet Explorer 8

Seeking assistance with a straightforward ajax request triggered by a user altering a select element. Implemented using jquery .ajax, the current functionality (which works in all browsers except Internet Explorer) involves loading a .html file via ajax, ...

The term 'undefined' does not refer to an object

My div contains the following code: <em id="ProductPrice" class="ProductPrice VariationProductPrice">$75.00</em> I want to change the text color if the value changes. This is what I tried: <script> $(document).ajaxSuccess(function(){ ...

CSS background image not displaying in ReactJS with SCSS

Currently, I am working on a React project and I am trying to incorporate a local image from a public folder as the background for a div container with transparent color. However, I am facing an issue where the image is not being displayed. I have success ...

Hosting completely disregards CSS class

Hey there, I'm currently facing an issue with my CSS file that contains all the styling for about ten different pages. The problem lies in the fact that the CSS classes are not being applied as they should be. Specifically, I have p tags within the ...

Anticipated spatial glitch problem involving the gadicc/meteor-reactive-window package for Meteor

Utilizing the gadicc/meteor-reactive-window Meteor Package to switch templates based on screen size. This file is named pictureDisplatSection.html <template name="pictureDisplaySection"> <div class="display"> ...

When the browser is resized, elements do not change position

I am attempting to build a website with solely horizontal scrolling. Check out this demo for reference. My issue arises when I resize the browser, as the content (paragraph within the light yellow box) fails to reposition itself. Ideally, I would like that ...

Simple jQuery slider that applies the active class to the slider list item

Currently experimenting with a plugin known as Basic jQuery Slider. I am attempting to figure out if it can display an active class on the visible slide. However, despite setting showmarkers : true, it doesn't seem to be working as expected. HTML: & ...