I would like to use a range slider input field and use the number as speed for this line of css. I cannot seem to make it work, I think because the number is changed inline css ? How to approach this?
<style>
.track-horizontal {
position: absolute;
white-space: nowrap;
will-change: transform;
**animation: marquee-horizontal 60s linear infinite; **
/* manipulate the speed of the marquee by changing "40s" line above*/
}
.track-horizontal:hover {
animation-play-state: paused;
}
@keyframes marquee-horizontal {
from { transform: translateX(0); }
to { transform: translateX(-50%); }
}
</style>
If you only have that element once on your page, you can do something like this. Changing entire CSS classes is possible, but I would just override the style on the element itself:
Hi @Kevin, you can also use css for this as you planned in the beginning. Just add a code embed on the page with the attribute li-settings:custom="range-slider". Inside add this json: {
"type": "range",
"id": "animation_speed",
"min": 1,
"max": 100,
"step": 1,
"unit": "s",
"label": "Animation Speed",
"default": 60
} Docu: https://shopify.dev/docs/storefronts/themes/architecture/settings/input-settings#range
Then add a custom element with this attribute style="animation: marquee-horizontal {{ section.settings.animation_speed }} linear infinite;"
And also add the rest of your CSS: <style> .track-horizontal { position: absolute; white-space: nowrap; will-change: transform; }
good to know. i thougt adding the unit inside would solve this π
Add a reply
Sign up and join the conversation on Discord
","dateCreated":"2024-10-03T15:27:56.868Z","dateModified":"2024-10-03T15:27:56.868Z","author":{"@type":"Person","url":"https://liquify.hall.community/members/b4493d12-c7f6-4370-8c1b-bca956985c92","name":"Jan","identifier":"b4493d12-c7f6-4370-8c1b-bca956985c92","image":"https://cdn.discordapp.com/avatars/547767203345334283/0120b0d0a42e96a26c61006e1380bc03.webp?size=256"},"commentCount":0,"comment":[],"position":3,"upvoteCount":0},{"@type":"Comment","text":"I have it more than once on my page, in webflow i would then use an id, not sure right now though","dateCreated":"2024-10-04T13:16:52.954Z","dateModified":"2024-10-04T13:16:52.954Z","author":{"@type":"Person","url":"https://liquify.hall.community/members/8b700aad-8ac4-432d-9401-5c44abf19015","name":"Kevin","identifier":"8b700aad-8ac4-432d-9401-5c44abf19015","image":"https://cdn.discordapp.com/avatars/1006974650649170020/ef75e3f8749ca2d66d80839a141c01da.webp?size=256"},"commentCount":0,"comment":[],"position":4,"upvoteCount":0},{"@type":"Comment","text":"Can give me the Webflow preview link if you have the setup built already? :)","dateCreated":"2024-10-04T13:24:20.635Z","dateModified":"2024-10-04T13:24:20.635Z","author":{"@type":"Person","url":"https://liquify.hall.community/members/b4493d12-c7f6-4370-8c1b-bca956985c92","name":"Jan","identifier":"b4493d12-c7f6-4370-8c1b-bca956985c92","image":"https://cdn.discordapp.com/avatars/547767203345334283/0120b0d0a42e96a26c61006e1380bc03.webp?size=256"},"commentCount":0,"comment":[],"position":5,"upvoteCount":0},{"@type":"Comment","text":"Hi @Kevin,you can also use css for this as you planned in the beginning.Just add a code embed on the page with the attribute li-settings:custom=\"range-slider\". Inside add this json:{ \"type\": \"range\", \"id\": \"animation_speed\", \"min\": 1, \"max\": 100, \"step\": 1, \"unit\": \"s\", \"label\": \"Animation Speed\", \"default\": 60\n}Docu: https://shopify.dev/docs/storefronts/themes/architecture/settings/input-settings#rangeThen add a custom element with this attribute style=\"animation: marquee-horizontal {{ section.settings.animation_speed }} linear infinite;\"And also add the rest of your CSS:","dateCreated":"2024-10-06T20:03:31.696Z","dateModified":"2024-10-06T20:03:31.696Z","author":{"@type":"Person","url":"https://liquify.hall.community/members/9198b265-c813-4ed7-89ba-4025d177dc62","name":"jonas.halbstark","identifier":"9198b265-c813-4ed7-89ba-4025d177dc62","image":"https://cdn.discordapp.com/avatars/947621552478904320/9741d807d28f33e26a3a3b01c121c60f.webp?size=256"},"commentCount":0,"comment":[],"position":6,"upvoteCount":0},{"@type":"Comment","text":"Oh, I understood that wrong, sorry. Jonas way is the way to go :D","dateCreated":"2024-10-07T06:08:46.311Z","dateModified":"2024-10-07T06:08:46.311Z","author":{"@type":"Person","url":"https://liquify.hall.community/members/b4493d12-c7f6-4370-8c1b-bca956985c92","name":"Jan","identifier":"b4493d12-c7f6-4370-8c1b-bca956985c92","image":"https://cdn.discordapp.com/avatars/547767203345334283/0120b0d0a42e96a26c61006e1380bc03.webp?size=256"},"commentCount":0,"comment":[],"position":7,"upvoteCount":0},{"@type":"Comment","text":"Hi Jonas, thanks that worked! Only thing I changed was adding \"s\" after the custom liquid.style=\"animation: marquee-horizontal {{ section.settings.animation_speed }}s linear infinite;\"to the track-horizontal element.","dateCreated":"2024-10-07T12:46:03.116Z","dateModified":"2024-10-07T12:46:03.116Z","author":{"@type":"Person","url":"https://liquify.hall.community/members/8b700aad-8ac4-432d-9401-5c44abf19015","name":"Kevin","identifier":"8b700aad-8ac4-432d-9401-5c44abf19015","image":"https://cdn.discordapp.com/avatars/1006974650649170020/ef75e3f8749ca2d66d80839a141c01da.webp?size=256"},"commentCount":0,"comment":[],"position":8,"upvoteCount":0},{"@type":"Comment","text":"Thanks anyways Jan for your input","dateCreated":"2024-10-07T12:48:15.959Z","dateModified":"2024-10-07T12:48:15.959Z","author":{"@type":"Person","url":"https://liquify.hall.community/members/8b700aad-8ac4-432d-9401-5c44abf19015","name":"Kevin","identifier":"8b700aad-8ac4-432d-9401-5c44abf19015","image":"https://cdn.discordapp.com/avatars/1006974650649170020/ef75e3f8749ca2d66d80839a141c01da.webp?size=256"},"commentCount":0,"comment":[],"position":9,"upvoteCount":0},{"@type":"Comment","text":"good to know. i thougt adding the unit inside would solve this π","dateCreated":"2024-10-07T13:27:52.690Z","dateModified":"2024-10-07T13:27:52.690Z","author":{"@type":"Person","url":"https://liquify.hall.community/members/9198b265-c813-4ed7-89ba-4025d177dc62","name":"jonas.halbstark","identifier":"9198b265-c813-4ed7-89ba-4025d177dc62","image":"https://cdn.discordapp.com/avatars/947621552478904320/9741d807d28f33e26a3a3b01c121c60f.webp?size=256"},"commentCount":0,"comment":[],"position":10,"upvoteCount":0}],"author":{"@type":"Person","url":"https://liquify.hall.community/members/8b700aad-8ac4-432d-9401-5c44abf19015","name":"Kevin","identifier":"8b700aad-8ac4-432d-9401-5c44abf19015","image":"https://cdn.discordapp.com/avatars/1006974650649170020/ef75e3f8749ca2d66d80839a141c01da.webp?size=256"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0}}]