Going back to topic https://theme.co/apex/forum/t/data-attributes/42768
The question was: “How to add data attributes” to an elements or columns/sections/rows. Now i have another question.
As i understand, there is a way of using jquery to ADD AN ATTRIBUTE WITH VALUE TO A CLASS. So here is a topic on stackoverflow.
Just like .attr(), you give two arguments to change the data:
$(".class").data("attribute", "value");
Note that if you add the data with .data rather than .attr, it stores it internally within jQuery, you won’t see it as a data-attribute attribute in the DOM. jQuery only uses the data-attribute attribute as an initial source of the value the first time you read it.
So the new question is, how to make it right.
I’ve added a AOS.js (https://michalsnik.github.io/aos/) to my test site. It have a data-attributes (and values) such as:
data-aos="fade-up"
data-aos-offset="200"
data-aos-delay="50"
data-aos-duration="1000"
data-aos-easing="ease-in-out"
data-aos-mirror="true"
data-aos-once="false"
data-aos-anchor-placement="top-center"
So i want to add this attributes with values to my custom classes with jquery and use it right. Declare a class “fade-up” with an attribute data-aos=“fade-up” and then i will apply this class to an element that will trigger up an animation.
So th question is… IS IT POSSIBLE? Can i use something like this?
$(".class").data("attribute", "value");
P.S. Sorry for my english )