Sam

Joined

150 Experience
1 Lesson Completed
0 Questions Solved

Activity

Hi everyone,

I'm trying to mark messages as "seen" when the div has entered the user's view (for example, the Facebook behavior of seen posts). My current attempt is a mix of the Unread gem (https://github.com/ledermann/unread) and the isOnScreen Jquery plugin (https://github.com/moagrius/isOnScreen).

But my two biggest problems are,

1) how do I get the Javascript to account for all ActiveRecord entries on a page? For instance, I can provide <div id="post-<%= post.id %>">, but how would I test for every possible div?
2) Once the Javascript confirms that a div is in view, how do I get it to send that information to Rails (to create a record in the user_read_posts table)?

Am I approaching this the wrong way altogether?