Streaming live at 10am (PST)

Jquery "Add Attribute" per "Class Name" not working until browser width is changed

Hi Wonderful Webflow Community :slight_smile:

I am attempting to use a line of JQuery code to add an attribute to a CMS item based on its class. In the example below I am not actually using a collection list but its the same idea. The code does work, but it only works after I resize the browser window.

Please don’t mind the fact that the site looks rough when the code is actually running lol

<script src=></script>


$('.Div-Block-2, .green').attr('data-scroll-speed','-5');


I’m not sure why, but the code does work when I change the width or height of the browser by even 1 pixel after it is live. So when I publish, the code doesnt run immediately, but it does run when I go to inspect the element and the browser width changes. I am #confused :joy:

I think it could have something to do with the element with the classes that the code is applied to being “in-view” or not, but I am not sure.

Here is my site Read-Only: Webflow - Parallax Scroll GridPreformatted text

Don’t load your own version of jQuery since it is already loaded by default by Webflow.

$('.Div-Block-2, .green') – the issue is probably the fact that your selector is wrong. Webflow converts class names to lowercase with hyphens for spaces when published on the front end. Update your selector accordingly.