mouse wheel scroll DIV element

If I have two DIV elements :

#my-div1 {
  position:absolute; /* relative or fixed  */
  z-index:20;
}
#my-div2 {
  position:absolute;
  z-index:10;
  height:500px;
  overflow:scroll;
}

Is it possible to scroll #my-div2 when mouse cursor is over #my-div1, using javascript?

Answers


You could use .mouseover() in combination with a scrolling library to execute the scrolling javascript:

$('#my-div1').mouseover(function() {
  //use Scroll library
});

A good library is ScrollTo.


Need Your Help

Permission denied: FastCGI: can't create server

apache2 debian fastcgi phpfarm

Using PHPFarm tuturial I tried to setup PHP version 5.4.45 on a Debian GNU/Linux 6.0.9 (squeeze). I follwed the steps and then at the end in the apache2 error log file, I got this error: