I do not know how to describe my concern and thats why I could not find anything on Google. I want to draw a div is focused at page call immediately and if you press the scroll wheel to scroll this div also. Whether you are with the mouse over the div or outside.
sorry for my bad english, google translator .... embarrassing ^_^
Update: https://github.com/brandonaaron/jquery-mousewheel Thank you... thats worked on all browser but not on the ipad... is it possible on ipad? –
If you want to scroll the div even if the mouse is else where on the page try this plugin https://github.com/brandonaaron/jquery-mousewheel. Here is an example assuming your div has an id of content:
$(function() {
var $target = $('#content');
$("body").mousewheel(function(event, delta) {
$target.scrollTop($target.scrollTop() - (delta * 30));
event.preventDefault();
});
});
Quick fiddle: http://jsfiddle.net/5h47wygo/
Try using JQuery. On document ready you focus on the div. You make the div scrollable by setting the overflow property in css.
JQuery:
$(document).ready(function(){ $( "#scrollable_div" ).focus(); }
CSS:
#scrollable_div {
overflow: scroll;
}