Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do something when user scroll until a div?

I have a div id="content".

Is it possible to do an action if a user see the id="content" ?

like image 392
Steffi Avatar asked Feb 19 '26 23:02

Steffi


1 Answers

I answered a similar questions at horizontal scroll, detecting scroll position relative to anchors

See working example http://jsfiddle.net/Vy33z/4/

You can also use a plugin if you are not too familiar with jQuery. The Appear plugin is great and easy to use. All you need to do is

$('#mydiv').appear(function() {
  alert('Your div is in view');
});
like image 126
Hussein Avatar answered Feb 22 '26 11:02

Hussein



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!