Using CSS to duplicate images in multiple repetitions horizontally

In the process of developing a UHD project that involves showcasing large images, I have encountered limitations with iOS and certain mobile browsers. While stationary browsers pose no issue, iOS only supports PNG images up to 5 megapixels in resolution, which falls short of what my project requires.

Unfortunately, using JPEG and other formats is not an option for me.

To work around this limitation, I have opted to divide big images into smaller ones. However, I have hit a roadblock along the way.

Here is a JSFIDDLE link where I have demonstrated the problem I am facing.

The demonstration showcases two images - a circle and a square - with the circle appearing on top of the square due to how they are structured.

Below is the CSS code snippet:

    <style type="text/css">
        html {
        overflow-x: hidden;
        }
        html, body { height: 100%; width: 100%;}
              body { overflow-x: hidden;
              background-image: url('http://www.clipartbest.com/download?clipart=di7eRd49T'), url('http://i126.photobucket.com/albums/p89/robertthomas_2006/600x600.png');
          background-repeat: repeat-x, repeat-x;
              background-position: left, right;
              }

There is also a jQuery segment:

    $(function(){
        var x = 0;
        setInterval(function(){
        x-=1;
        $('body').css('background-position', x + 'px 0');
    }, 10);
    });

The challenge lies in getting these "small" images to appear side by side without stitching them back into one big image, as it proves problematic for mobile devices.

It seems like the "background-postion" property in the CSS is being ignored for some reason.

Is there a way to apply "background-repeat: repeat-x" to all the background images as a cohesive unit and display them side by side?

I need to have anywhere from 2 to 10 background images repeated simultaneously as a seamless whole.

Do you think it's achievable through my current approach? If not, what would be the most effective solution to this issue?

Answer №1

The background property may not be the most effective way to achieve your desired effect. I suggest placing the images in a div instead, which can then be positioned below other content using absolute positioning to act as a background. Make sure to also set the z-index for your content to ensure it appears above the "background" div. Additionally, consider restarting the animation once it reaches the last image instead of repeating the entire sequence endlessly. Feel free to reach out if you need further clarification on any of the points mentioned above.

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 absence of the Django CSRF token has been detected

Inside the custom.js file, there is a function defined as shown below : function contactTraxio(fullname, telephone, email) { if (typeof(fullname)==='undefined') fullname = null; if (typeof(telephone)==='undefined') telephone = ...

Looking to reload a div with a captcha in a contact form without the need to refresh the entire page

I have integrated a div tag into my contact form to contain the captcha elements. If the user is unable to read the captcha image, I want to provide them with an option to refresh that specific section without reloading the entire page. I have tried variou ...

Select the M3 element in a ul using CSS targeting

I am working with a ul containing some li elements, here is an example: <ul class="M199 WIDTHBOX1 5ColumnBox"> <li class="M2"> <a class="M2" href="about-1561.aspx" target="">About</a> <div class="WIDTHBOX2" s ...

Recommendation for a jQuery slider extension for setting ranges

Looking for a smaller range slider plugin similar to http://jqueryui.com/demos/slider/#range. I don't want to include the whole UI pack just for the slider feature, as it's too large at 150 KB. ...

Issue with jQuery - Exchanging positions of two elements fails after the initial swap

I'm currently using a function to perform a bubble sort on the content of multiple div elements. During each swap operation, it swaps the divs as well by utilizing the JQuery Swapsies plugin. The issue I’m facing is that after the initial swap, subs ...

An HTML attribute with a blank value will not display the equals sign operator

jQuery can be used like this: $select.append('<option value="">All</option>'); This code appears to insert the element in HTML as follows: <option value>All</option> However, what is intended is to append the elemen ...

Static addition of the Button to the parent div is crucial for seamless

Introduction: My current project involves managing interns, and I am focusing on the employee side. Employees have the ability to add, edit, and delete interns through modal popups. Strategy: To avoid unnecessary repetition of code, I decided to create a ...

Perform a series of consecutive AJAX requests using jQuery

Currently, I am dealing with an endpoint that is not functioning well. It's important to note that I do not have the ability to modify how this particular endpoint works. The specific ajax call in question is: POST /doStupidThing/. I have a list of ...

Achieving consistent column heights in Bootstrap by aligning neighboring columns

I am striving to achieve a layout similar to this: https://i.sstatic.net/HIEB4.png However, in Bootstrap, I am currently getting this: https://i.sstatic.net/sLw1v.png My desired layout specifications are as follows: Width ratios should be in the propor ...

Center an element over two other elements using CSS

I have three elements: checkout-left, checkout-right, and product-2 <div class="order-form"> <div class="checkout-left"> <div class="video another-video"> ...

Is Core Image face detection malfunctioning on 64-bit iOS devices?

Recently, I encountered an issue with my app that utilizes the face detection feature of Core Image on my iPhone 5s. The app no longer detects faces and I am receiving an error in the console during debugging: /System/Library/PrivateFrameworks/FaceCore. ...

JQuery organizing and arranging list with drag and drop functionality

Hey there, I've encountered a little dilemma. I've developed a drag and drop list feature in my WordPress plugin that allows users to rearrange categories. For the most part, it's working smoothly... The table is being populated from a MySQ ...

Using Bootstrap Tooltips has been a bit of a rocky journey - it's functional, but not without its flaws

I would like the tooltip to be triggered by the 'focus' event. It seems that it only appears after being focused, and then behaves like a :hover effect each time. Am I using jQuery correctly with bootstrap tooltips? It doesn't seem so, right ...

Pressing the "Enter" key will submit the contents of

Hello, I have recently created a new chat box and everything seems to be working fine. However, I am facing an issue with submitting a message when I press enter (to go to the function Kucaj()). Can anyone provide assistance with this problem? I tried ad ...

Error: The method specified in $validator.methods[method] does not exist

Having trouble solving a problem, despite looking at examples and reading posts about the method. The error I'm encountering is: TypeError: $.validator.methods[method] is undefined Below that, it shows: result = $.validator.methods[method].call( t ...

Position the SVG next to the link text in a Bootstrap navbar brand

I am using the .navbar-brand class from Bootstrap to include an SVG in my navbar. However, I want to display text next to the SVG and align it properly. The SVG and text are currently in the navbar but they are not aligned correctly. Below is the code snip ...

Set the array back to its initial value of 1 using jQuery and

After making substantial edits to this question, I find myself in need of a reset button for the code. The current item needs to be reset back to 1 so that I can use it again, but the issue lies in the fact that only the current item is reset while the hig ...

Retrieve the character count of the text within a dynamically created div using AJAX

I have a .php file containing an array of strings. One of these strings is fetched by my page and inserted into an empty div named post. However, when I try to determine the length of the string in the post, I always receive the error: Uncaught TypeErro ...

I can't seem to get my code to work more than once

My code seems to be working only once. This is the HTML code snippet I am using: <span id="0" class="add-title">add title</span> And here is my JavaScript code: jQuery(document).ready(function($) { var iTitlesArray = []; $(document ...

Utilizing Jquery to pass two classes along

I am looking for assistance on how to pass multiple classes within if-else statements and jQuery. My goal is to have both divs and divs2 change when the next button is clicked. Can someone please provide guidance on achieving this? --code not mine-- ...