Answer the question
In order to leave comments, you need to log in
jQuery: "Element viewed" event?
Hello habra community!
There was a need to somehow handle the event of the full appearance of the object (in this case, div, although this, in fact, does not matter) in the scope of the browser window. To be more precise, you need to send an ajax request to the server, which assigns the “read” status to the comment as soon as the user conditionally “read” it (the comment came into his field of vision).
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
You can implement this with jQuery.offset() and jQuery.scrollTop(). Well, throw it out, for example, trigger("shown")
Maybe this plugin will help you: imakewebthings.github.com/jquery-waypoints/
Track the change in window.scrollTop
Find the coordinates of the desired div - x1, y1, x2, y2
Check if the rectangle falls completely into the rectangle window.scrollTop, window.scrollLeft, get the viewport correct with the doctype in mind).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question