scroll() event handling in JQuery

Triggers with scrolling in element or on window. Syntax is here
$(window).scroll(function(){
/// code here ///
})

  • Video Tutorial on window scroll Events


Demo is here , scroll this textarea and then scroll this browser window. ( See the scroll message )
scroll this window

JQuery

<script>
$(document).ready(function() {
// Jquery code here ///
$('#t1').scroll(function(){
  $('#d1').html("Textarea scroll started" )
  //$( "#d1" ).css( "display", "inline" ).fadeOut( "slow" );
  setTimeout(function() { $('#d1').html("Textarea stopped ..." ) },500);
})
////

$(window).scroll(function(){
  $('#d1').html("window scroll  started" )
  //$( "#d1" ).css( "display", "inline" ).fadeOut( "slow" );
  setTimeout(function() { $('#d1').html("window scroll stopped ..." ) },500);
})
////////
});
</script>

HTML

<textarea id=t1 name=t1 rows =5 cols=25>Line one
  Line ....
  
  Line ....
  Line ....Line ...
  Line ....
</textarea>
	
	<div id=d1 class='alert alert-primary'>scroll this window</div>

  • Video Tutorial on keyboard Events


Event Reference resize()
Keypress() keyup() keydown() Learn which key is pressed by user

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here .







    Most Popular JQuery Scripts

    1

    Two dependant list boxes

    2

    Calendar with Date Selection

    3

    Data change by Slider

    4

    Show & Hide element


    JQuery Video Tutorials




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer