The problem seems to be the $this
reference, in your case it is referring the window
object.
Instead you need to refer the current [data-load-animation]
element, so define it within the each()
loop
$(document).ready(function () {
$("[data-load-animation]").each(function () {
var $this = $(this);
$this.hide();
var cls = $this.data("loadAnimation");
console.log("console: " + cls);
$this.addClass(cls);
})
})