API cryptocurrency marquee
Enhance your website with a dynamic cryptocurrency marquee Webflow cloneable. Display live crypto data with real-time pricing and interactive hover effects for a user-friendly experience. Customize speed and direction easily. Ideal for investors and enthusiasts.
Categories
js library
This Webflow cloneable, crafted by Dhruv Sachdev, offers an innovative solution for displaying live cryptocurrency data through a dynamic infinite marquee. Utilizing the CoinGecko API, it fetches and showcases real-time pricing information and percentage changes for a variety of popular cryptocurrencies, including Bitcoin, Ethereum, and Solana.
With its visually engaging design, the marquee continuously scrolls through current values, enhancing user engagement by providing a constant stream of relevant financial information. The addition of token logos, reverse-engineered from a recognized exchange, adds a polished touch to the overall presentation. Users can easily extend the list of displayed tokens by modifying the fetch URL.
A key feature of this marquee is its interactive hover effect; the scrolling pauses when users hover over it, allowing for an easier reading experience. This thoughtful addition emphasizes usability, improving the site's overall user experience.
Webflow users will benefit significantly from integrating this cloneable feature into their websites. It not only enhances the aesthetics of their site with a modern, animated ticker but also keeps visitors informed with live updates on cryptocurrency prices. This can elevate a website's functionality, making it a valuable resource for investors and cryptocurrency enthusiasts alike. With easy customization options for speed and direction, along with the lack of reliance on external libraries, this solution is both efficient and adaptable to individual design needs.
Incorporating this cloneable into a Webflow project can effectively transform how financial information is presented, making it accessible and visually appealing for a diverse audience.
How does the .marquee-track
class work in Webflow?
The .marquee-track
class is designed to create a scrolling marquee effect for web elements. It uses CSS properties like position: absolute;
to position the element independently of its normal flow, and white-space: nowrap;
ensures that the content within the marquee does not wrap, maintaining a single line of text. The will-change: transform;
property hints to the browser that the transform property will change, allowing for optimized performance during the animation. The class defines an animation named marquee
that animates the element over 50 seconds in a linear fashion and loops infinitely in reverse.
How does the hover effect enhance the user experience for the marquee in Webflow?
The hover effect is implemented with the .marquee-track:hover
selector, which pauses the scrolling animation when the user hovers over the marquee. This is achieved by setting the animation-play-state
to paused
for standard browsers and including vendor prefixes for Firefox (-moz-
) and WebKit browsers (-webkit-
). This interaction allows users to read the text more comfortably and increases usability, which is a crucial aspect of user experience design.
What are the keyframes used for in the marquee effect in Webflow?
The @keyframes marquee
rule defines the animation's start and end states. The animation transitions from translateX(-50%)
at the start to translateX(0%)
at the end, effectively moving the text from one end of the screen to the other. By using the CSS transform
property, it ensures that the movement is smooth and visually appealing, enhancing the overall aesthetics of the web design.
Can this marquee style in Webflow be easily customized for different speeds or directions?
Yes, the marquee speed can be adjusted by changing the duration in the animation: marquee 50s linear infinite reverse;
declaration. For instance, decreasing the number of seconds will result in a faster movement, while increasing it will slow down the animation. Additionally, you can modify the @keyframes
to change the direction of the marquee by altering the translateX
values, such as switching from negative to positive values.
How does the JavaScript code enhance a Webflow project with cryptocurrency data?
The JavaScript code is designed to fetch and display the latest cryptocurrency prices on a webpage, making it highly relevant for projects created in Webflow that aim to showcase financial information. By using APIs, the script pulls real-time price data for various cryptocurrencies and displays this dynamically on the site. The seamless integration showcases up-to-date information, improving user engagement.
What external libraries are utilized in this JavaScript code?
This code imports several external libraries, notably the html5shiv for enabling HTML5 elements in old versions of Internet Explorer, and placeholders for better input placeholder support. The script also includes a custom library, crypto-marquee, presumably to enhance or control the presentation of the cryptocurrency data in a marquee-type display. They ensure that the code works well across different browsers and enhances the visual appearance in Webflow.
How does the code handle fetching cryptocurrency prices?
The code uses the fetch
API to retrieve cryptocurrency prices from the CoinGecko API. It constructs a URL that specifies the desired cryptocurrencies and various parameters like market cap, volume, and change percentage. Once the data is successfully fetched, it is transformed into a JSON object for easy manipulation.
How does the buildCryptoMarquee
function work in the script?
The buildCryptoMarquee
function acts as the core of the script. It contains two helper functions: nameToSymbol
, which converts the full cryptocurrency name into its respective symbol, and numberWithCommas
, which formats numbers with commas for better readability. The main function processes the fetched data to dynamically create HTML elements representing the cryptocurrency information, including logos, prices, and percentage changes, which it appends to elements with the class marquee-item
.
What role does the getColor
function play in this JavaScript code?
The getColor
function evaluates the percentage change in price over the last 24 hours and returns appropriate CSS styling for color-coded visual cues. It distinguishes between positive and negative changes, assigning green for increases and red for decreases. This enhances user understanding of market trends, making it more visually appealing in a Webflow project context.
What happens when the DOM content is fully loaded according to the script?
Upon the event DOMContentLoaded
, which signifies that all the HTML has been completely loaded and parsed, the buildCryptoMarquee
function is called to execute. This means that the cryptocurrency data extraction and display process begins immediately after the document becomes interactive, ensuring users see updated information as soon as they access the webpage. This feature improves overall user experience in any Webflow site.
**How does the script improve readability of cryptocurrency prices? **
The function numberWithCommas
formats numerical prices by converting them into a localized string with commas as thousands separators. This makes it easy for users to read and comprehend price figures at a glance, enhancing the overall clarity and appealing design of the cryptocurrency display on a Webflow webpage.