当滚动条的父控件获得焦点时,可以使用鼠标的滚动轮来控制滚动条 public partial class Form1 : Form { public Form1() { InitializeComponent(); this.richTextBox1.MouseWheel += new System.Windows.Forms.MouseEventHandler(richTextBox1_MouseWheel); } void richTextBox1_MouseWheel(object send
<script> var firefox = navigator.userAgent.indexOf('Firefox') != -1; function MouseWheel(e) { ///对img按下鼠标滚路,阻止视窗滚动 e = e || window.event; if (e.stopPropagation) e.stopPropagation(); else e.cancelBubble = true; if (e.preventDefault) e.preventDefault(
JavaScript鼠标滚轮事件 IE6.0首先实现了鼠标的滚轮事件,其良好的交互效果得到认可,随后Opera.chrome.safari等主流浏览器都实现了该效果,不过存在着很大的兼容问题. 大多数浏览器支持mousewheel事件操作,它可以在任何元素上触发,最终冒泡到document或window对象:而在Firefox中,支持的是另外一种事件--DOMMouseScroll,其中最为特殊的是它必须用addEventListener方法实现,故一般进行如下处理 //设触发的函数为fn if