Are you first timer at lazacode.org? Why not join us and start exchange your knowledge with everyone. Register today!

jQuery .scroll() events

0 votes
4 views
added Apr 3 in jQuery by LC Marshal Second Warrant Officer (6,010 points)

if scroll more than 147, do this, else do this

window.addEventListener('scroll', function(e) {
  if (window.scrollY > 147) {
    $('body').addClass("fix-prop-header");
  } else {
    $('body').removeClass("fix-prop-header");
  }
});

1 Example

0 votes
responded Apr 3 by LC Marshal Second Warrant Officer (6,010 points)

If #target scrolled, find #log and append the div

$( "#target" ).scroll(function() {
  $( "#log" ).append( "<div>Handler for .scroll() called.</div>" );
})
lazacode.org - Malaysia based Knowledge Exchange Platform, where you can share your finding or solution with other members of community.
...