Create an image that repeats vertically with endless scrolling

Is it possible to create a never-ending vertical image scrolling effect as the user scrolls down?

I am aware of how to repeat an image horizontally or vertically, however, I want the image to continuously repeat as the user continues to scroll down the page.

If possible, I would like to achieve this using CSS or HTML.

Here is what I have so far, but I need help figuring out how to make the div infinitely carry on:

CSS:

.slide {
    width:30px;
    height:1000px;
    background-image:url(http://paulbourke.net/fractals/noise/noise2d.gif);
    background-repeat:repeat-y;
    margin:0 auto;
}

HTML:

<div class="slide"></div>

Fiddle

Answer №1

While creating HTML elements with infinite height may not be feasible, one workaround is to utilize javascript to enlarge an element when a user reaches the bottom of the page.

Answer №2

Using just HTML, achieving infinite scrolling is theoretically impossible. You can either set an absolute height and min/max height values or use "auto" to adjust the box height based on content size.

To simulate infinite scrolling, one could set an extremely high absolute height like 100000px; but this would negatively impact browser performance.

Implementing Ajax to respond when the scrollbar reaches the bottom and appending hidden content can create the illusion of infinite scrolling.

A possible implementation:

$(window).scroll(function () {
    //- 10 = desired pixel distance from the bottom of the page while scrolling)
    if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {
        var box = $("#myBoxId");
        //Just append some content here
        box.html(box.html() + "<br /><br /><br /><br /><br /><br /><br />");
    }
});

This method allows for expanding content as the user scrolls, possibly loading additional content using Ajax.

An image set to repeat-y will also expand with this effect.

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

What is the process for implementing custom CSS styles in Cognos?

I've been working on creating Cognos reports and I'm looking to change the overall design of some specific ones (prompt pages and report pages). Is there a way for me to use different custom CSS files for each individual report? If that's ...

What is the process for terminating a prototype ajax request?

Currently, I have an AJAX call that is sending requests every 10ms: function sendRequest(){ new Ajax.Request(getProgressUrl, { method: 'get', onComplete: function(transport) { setTimeout(updateCsvExportProgre ...

Organize information before making a choice in the dropdown menu

Currently, I have a dropdown menu in HTML that allows you to order the data by different options: <select ng-model="sortOrder" ng-options="option.value as option.name for item in options"></select> In addition, I have implemented code using n ...

Chrome is experiencing a rendering problem as a result of using @Font-Face

Having trouble with rendering in my Angular 4 application, similar to the issue outlined in this post about Angular 2 Chrome DOM rendering problems. Despite there being a solution provided in that post, I am still facing difficulties when navigating betwee ...

How to display HTML string in iOS using Swift without using UIWebView

Is there a way to display the following HTML string in a UITableViewCell? How can I achieve this? <p>\r\n\t Samsung Full HD delivers stunning images, whether it's a premium-quality 2D picture or an incredible 3D experience. When ...

Why is the col-1 in Bootstrap stacking up instead of flowing horizontally as intended?

Check out my HTML/CSS code below: <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <d ...

Achieving navigation bar functionality in Bootstrap using jQuery

Is there a way to make the navbar active when it is clicked? Below is the jQuery code I am currently using: $(document).ready(function () { $('.navbar li').click(function(e) { $('.navbar li').removeClass('acti ...

Create spacing on the right side of a div with Bootstrap 4 offset, instead of the typical left side offset

Looking for a solution in Bootstrap 4 that mirrors the offset feature in Bootstrap 3, but pushes a div to the left instead of right. Need a way to have multiple dynamic divs within a row, where one div is pushed to the left on its own row without the nee ...

Trouble with z-index property within the confines of the <ion-segment-button></ion-segment-button> tag

The z-index property seems to be having no effect on the elements within the ion-segment-button. I attempted to adjust the positions of the elements and set the z-index to 999999 with the button z-index set to -1. However, this solution did not work as ex ...

angularjs reset file input form

Whenever I click publish, I want to clear my form: $scope.product = {}; $scope.upload = function(user) { var formData = new FormData; $scope.product.owner = user; for (key in $scope.product) { ...

Absolute positioning of a div relative to its immediate parent element

Within my code, there are three nested div elements: <div id="div1"> <div id="div2"> // contains content <div id="div3"> // includes some content with a form </div> </div> </ ...

What is the best way to integrate HTML code within a JavaScript function?

I need the HTML code to execute only when a specific condition in JavaScript is met. Here is the JavaScript code: <script type="text/javascript"> $(document).ready(function () { if(window.location.href.indexOf("index.php") > -1) { ...

What is the best way to incorporate annotations onto a website without impacting the overall design and layout?

I'm currently working on a personal project that is similar to markup.io where users can load any website and add annotations. I am struggling to implement an annotation feature that functions like the one in markup.io: Does not disrupt the styling o ...

Creating a unique Web Component that spans the full height of the page

I created a Web Component with Vue.js and vue-custom-element. I now want my my-chat and my-whiteboard Web Components to have a height of 100%. Here's how I'm using the component: // App.vue <template> <splitpanes class="default-theme" ...

Words existing outside of an element

Currently, I am developing a slider using Bootstrap, and I have encountered an issue where the text displays on the left instead of aligning to the center in relation to the elements. To see this issue in action, you can check out the live demo here: In ...

Experiencing data loss while utilizing BeautifulSoup

I am currently working on a tutorial from the book 'Automate the Boring Stuff with Python' where I am practicing a project titled 'Project: “I’m Feeling Lucky” Google Search' Unfortunately, the CSS selector used in the project is ...

JavaScript code that triggers when a checkbox is not selected

I'm attempting to dynamically add an input field when a checkbox is clicked, with the intention of having the checkbox already checked by default. However, I am encountering an issue where the checkbox remains unchecked even after the input field is d ...

What is the best way to incorporate an options tabbed menu into a mega drop-down menu?

I came across a useful code snippet on The code snippet offers users a choice of 3 options with tabbed menus. Take a look at the website to see how this tabbed menu functions. Here is the code for this snippet <div class="row-fluid"> <div ...

How can you hide specific elements in HTML/CSS based on window size without relying on media queries?

How can I create an HTML/CSS toolbar where specific elements disappear completely when the browser size is decreased, similar to how the favorites bar functions in most browsers? The toolbar should be able to display a varying number of items. In this cas ...

The newly implemented "secret bottom section" is causing some content to overlap at the bottom of the page

As I work on the design of my website , I find myself in need of CSS assistance. If your current screen resolution doesn't highlight the issue, try adjusting the window size so that the 2-column layout in the sample would cause the footer to shift-- e ...