Seamless Scrolling Background
How do I make an seamless scrolling background?
Wanted to try a "fishbowl" approach for showing a group of logos. Easy to do by animating a background image's position. Have to use VW units to tell it to move the entire width of the viewport – will NOT work unless in Full Page/Debug mode, though.. What is a seamless scrolling background? How do you make a seamless scrolling background? This script and codes were developed by Joshua P. Larson on 23 July 2022, Saturday.
Seamless Scrolling Background - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Seamless Scrolling Background</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ body { height: 100%; background: #efefef;
}
.slider { background-image: url(http://placehold.it/800x200); margin: 1rem auto; height: 200px; animation: slide 5s linear 0 infinite; background-size: auto;
}
@keyframes slide { from { background-position-x: 0%; } to { background-position-x: 100vw; }
}
h1, p { padding: 1em;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <h1>Seamless scrolling background</h1>
<div class="slider"></div>
<p> The background above will loop at the duration defined in the CSS animation property. It uses the <strong>vw</strong> unit to tell the background's positon to move the entire width of the viewport.
</p> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
</body>
</html>
Seamless Scrolling Background - Script Codes CSS Codes
body { height: 100%; background: #efefef;
}
.slider { background-image: url(http://placehold.it/800x200); margin: 1rem auto; height: 200px; animation: slide 5s linear 0 infinite; background-size: auto;
}
@keyframes slide { from { background-position-x: 0%; } to { background-position-x: 100vw; }
}
h1, p { padding: 1em;
}
Developer | Joshua P. Larson |
Username | jplhomer |
Uploaded | July 23, 2022 |
Rating | 3 |
Size | 2,535 Kb |
Views | 40,480 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
JS Geolocator | 2,653 Kb |
Displaying a Google Street View of your current location | 2,275 Kb |
Fixed Nav HoverIntent Example | 4,444 Kb |
Webkit Text Masking | 1,975 Kb |
Lightweight Quiz Widget | 4,596 Kb |
Responsive HTML Timeline | 3,137 Kb |
Animated Donut Chart | 3,808 Kb |
CSS-Only Art Direction | 4,086 Kb |
Hey React | 3,959 Kb |
Verge-Style Homepage Tiles | 5,147 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Magnus 3 | ARocketfish | 7,944 Kb |
3D Text in Sass | Bookcasey | 2,766 Kb |
Lunar eclipse | Ademilter | 2,056 Kb |
Nested flexbox layout for library catalog | Boycetrus | 3,271 Kb |
Planet Awesome | Bartuc | 3,554 Kb |
About Mazano | Kiti | 2,585 Kb |
Simple Linear Regression with Editable Table | Melatonind | 3,264 Kb |
CSS3 Form Page Design | Rssatnam | 3,613 Kb |
Material design buttons | Fischaela | 4,381 Kb |
Tile Animation Thing | Frxnz | 4,332 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!