I am in need of creating two marquees for a website project. The first marquee should showcase a repeating image while the second one should display links, both spanning the browser window at any size. It is crucial that the marquee items are displayed from the start and do not take time to appear on screen. Additionally, I require each item to be spaced about 20px/30px apart. An important feature is that when a user hovers over the marquee, it should pause moving across the page.
For this project, I have decided to incorporate a marquee displaying the client's logo on one page and on another page, a marquee showcasing links to their social media profiles. However, calculating the necessary animation duration based on the text or image size to achieve an infinite appearance has proven challenging for me. After exploring CSS options and seeking advice without much success, it seems Javascript is the recommended approach. While I am new to Javascript and feeling quite lost, I found a similar solution here: . To visualize my goal, you can refer to this example: (specifically the bottom marquee moving left to right without overlapping). Attempting to implement the desired effect, I used this code snippet as a reference: https://codepen.io/jamesbarnett/pen/kfmKa.
body {
margin: 0;
font-family: "UniversLTPro-Ex";
font-size: 30px;
}
a {
text-decoration: none;
color: #000;
}
.marquee {
height: 35px;
width: 100%;
overflow: hidden;
position: relative;
background-color: #e9e5fb;
border-top: 1px solid black;
border-bottom: 1px solid black;
padding: 8px 0 4px 0;
}
.marquee div {
display: inline-block;
width: 300%;
height: 40px;
position: absolute;
overflow: hidden;
animation: marquee 12s linear infinite;
}
.marquee span {
float: left;
width: 25%;
}
@keyframes marquee {
0% { left: 0; }
100% { left: -150%; }
}
<div class="marquee">
<div>
<span><a href="#">twitter</a></span>
<span><a href="#">instagram</a></span>
<span><a href="#">pinterest</a></span>
<span><a href="#">spotify</a></span>
<span><a href="#">magazine</a></span>
</div>
</div>
My attempts so far have faced various problems. The marquee does not loop infinitely, the hover pause functionality remains unresolved, and the spacing between items is too wide. Any assistance on addressing these issues would be highly appreciated. Thank you!