mardi 21 avril 2015

CSS Scroll with div content but not out of own div

What ive got: I have a list of users. Each User can lift his hand to give a sign. The hand is symboled in an other div outside the user div. If the userdiv is not high enough for the amount of users, it is scrollable. The div with the signs is mapped to the scrolling. This all works see:

Fiddle!

//Scroll mapping    
$( "#userframe" ).scroll(function() {
            $("#handdiv").scrollTop($(this).scrollTop());
});

The Problem: If a user gives a sign but is out of the visable part of the userdiv... no one can see it.

The Idea: So my idea is, that hand-signs never scroll out of view in the right div (even if the user scrolls outside of the userdiv) and stack on its bottom and top. But they scroll with the user if the user is visible in the left div.

I have no idea how this can be done! I can imagen it can be done with affix.js but this is only for one element i guess :(

can someone give me a hint for what i have to search or how this can be done ? Thanks a lot :)

Aucun commentaire:

Enregistrer un commentaire