I'm experimenting with parallax scrolling, and I want to do something like:
$('.page').each(function() {
$(this).css("background-position",
"center " + ((window.pageYOffset - $(this).offset().top) /
$(this).css("speed")) + "px");
});
Where speed is an attribute assigned to the specific item that controls the movement speed of an item during scrolling. So I would have something like:
#item { speed: 4; }
and
<div name="item" class="page"></div>
I understand this might not be possible with CSS. HTML5 supports custom attributes, but I'd rather declare these things somewhere in the head with other information about the element.
Any recommendations on how to do this?
Thanks!