How to Change Div Background Color When Div is Scrolled Top
Hi All,
I've spent several hours to change the color of div background.
My question is How to change background color of div when the div is scroll top ?
Code
- var docInHeight = jQuery(this).innerHeight;
- var obj_div = jQuery('#div');
- obj_div.scroll(function () {
- if (jQuery(this).scrollTop() == 0) {
- jQuery(this).css('background', 'red');
- }
- })
Thanks in advance