Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Triggering jquery event when an element appears on screen

Tags:

jquery

I want to show a fade effect as soon as the element appears on screen. There is a lot of content before this element so if I trigger the efect on document.ready, at certain resolutions the vistors wont´t see it.

Is it possible to trigger an event when, after scrolling down, the element becomes visible? I am almost sure I have seen this effect before, but have no idea how to achieve it.

Thank you!

like image 999
agente_secreto Avatar asked Jun 15 '10 14:06

agente_secreto


1 Answers

jQuery Waypoints plugin could be useful. It provides a way to trigger an action when an element becomes visible on the screen.

For instance:

$('.entry').waypoint(function() {    alert('The element has appeared on the screen.'); }); 

There are some examples on the site of the plugin.

like image 61
Fedir RYKHTIK Avatar answered Sep 28 '22 07:09

Fedir RYKHTIK