mousewheel

event.preventDefault(); not stopping mousewheel in Firefox

梦想与她 提交于 2019-12-04 03:07:21
问题 I am using the mousewheel in jquery to increase the number of a div, the number increases correctly but the scroll is not stopped in Firefox. $(document).ready(function(){ $('#test').bind('mousewheel DOMMouseScroll', function(event){ var currentValue = parseInt($('#test').text(),10), newValue = currentValue + 1; $('#test').text(newValue); event.preventDefault(); }); }); Fiddle: http://jsfiddle.net/rHVUn/ The fiddle uses the standard mousewheel detection, but I have also used Brandon Aaron's

How can I scroll my panel using my mousewheel?

有些话、适合烂在心里 提交于 2019-12-04 02:47:08
问题 I have a panel on my form with AutoScroll set to true so a scrollbar appears automatically. How can I make it so a user can use his mouse wheel to scroll the panel? Thanks SO. 回答1: The panel or a control in the panel must have focus. Note that if the control with focus has scroll bars, it will scroll instead of the panel. 回答2: What worked for me was adding panel1_MouseEnter EventHandler: private void panel1_MouseEnter(object sender, EventArgs e) { panel1.Focus(); } 回答3: Below code works for

jquey实现放大镜功能

こ雲淡風輕ζ 提交于 2019-12-04 01:20:30
(function ($) { $.fn.imagezoom = function (options) { var settings = { xzoom: 220, yzoom: 220, offset: 10, position: "BTR", preload: 1, scale:1 }; if (options) { $.extend(settings, options); } var noalt = '',iTop,iLeft,iWidth,iHeight; var self = this; return self.each(function () { self.imagezoom = true; var _this = this; var explorer = navigator.userAgent; var mouseAdd = "mousewheel"; if (explorer.indexOf("Firefox") >= 0) { mouseAdd = "DOMMouseScroll"; } $("body").off(mouseAdd).on(mouseAdd, "div.zoomMask", function (ev) { var $this = $(this); var imgWid = $("div.zoomDiv>img").width(); var

Always scroll a div element and not page itself

ぃ、小莉子 提交于 2019-12-04 00:52:07
问题 I have a page layout with an inner <div id="content"> element which contains the important stuff on the page. The important part about the design is: #content { height: 300px; width: 500px; overflow: scroll; } Now when the containing text is larger than 300px, I need to be able to scroll it. Is it possible to scroll the <div> , even when the mouse is not hovering the element (arrow keys should also work)? Note that I don’t want to disable the ‘global’ scrolling: There should be two scrollbars

OSX inertia scrolling causing mousewheel.js to register multiple mousewheel events with the slightest scroll motion

别说谁变了你拦得住时间么 提交于 2019-12-03 16:20:09
I have a pretty standard Flexslider instance I'm working on. Flexslider incorporates well with the jquery.mousewheel.js plugin, allowing slides to move on mousewheel events. However, Mac OSX and others employ 'intertia' to scrolling effects, making it virtually impossible to scroll only one slide left or right. The general effect is that even the slightest scroll motion in these situations triggers multiple mousewheel events and scrolls the slider multiple images left or right. Obviously, this can't happen! I think the solution is to use underscore.js - specifically the 'debounce' function.

How to read out scroll wheel info from /dev/input/mice?

∥☆過路亽.° 提交于 2019-12-03 15:29:34
For a home robotics project I need to read out the raw mouse movement information. I partially succeeded in this by using the python script from this SO-answer . It basically reads out /dev/input/mice and converts the hex-input into integers: import struct file = open( "/dev/input/mice", "rb" ) def getMouseEvent(): buf = file.read(3) button = ord( buf[0] ) bLeft = button & 0x1 bMiddle = ( button & 0x4 ) > 0 bRight = ( button & 0x2 ) > 0 x,y = struct.unpack( "bb", buf[1:] ) print ("L:%d, M: %d, R: %d, x: %d, y: %d\n" % (bLeft,bMiddle,bRight, x, y) ) while True: getMouseEvent() file.close() This

Why is WheelDelta = 120?

人盡茶涼 提交于 2019-12-03 11:24:54
I'm working with mouse events, specifically OnMouseWheel . Many code samples refer to distance the view changes (or zoom f.i. in 3D application) as Distance = Sign(WheelDelta)*Constant or Distance = WheelDelta / WHEEL_DELTA or something of that kind - assuming that WheelDelta is always a multiple of 120 (WHEEL_DELTA constant = 120). I already found that in touch interfaces / tablets input may depend on scrolling length. I was wondering why Microsoft has set default WheelDelta to 120, why not 100 or 10 or anything else? In what other cases wheel delta may be something different from 120? Holger

How can I make WPF ScrollViewer middle-click-scroll?

回眸只為那壹抹淺笑 提交于 2019-12-03 11:09:32
Clicking the middle mouse button (aka: mouse wheel) and then moving the mouse down slightly lets users scroll in IE, and most Windows apps. This behavior appears to be missing in WPF controls by default? Is there a setting, a workaround, or something obvious that I'm missing? I have found how to achieve this using 3 mouse events ( MouseDown , MouseUp , MouseMove ). Their handlers are attached to the ScrollViewer element in the xaml below: <Grid> <ScrollViewer MouseDown="ScrollViewer_MouseDown" MouseUp="ScrollViewer_MouseUp" MouseMove="ScrollViewer_MouseMove"> <StackPanel x:Name=

How do I suppress window mouse wheel scrolling…?

十年热恋 提交于 2019-12-03 06:57:39
I'm working on a canvas app embedded in a page. I have it so you can zoom into the drawing with the mousewheel but unfortunately this scrolls the page as it is part of an article. Is it possible to prevent mousewheel scrolling on the window when I'm mousewheeling on a dom element?! Attach an event handler for mousewheel (Not Gecko) / DOMMouseScroll (Not IE) and prevent its default action (that is to scroll content): if (element.addEventListener) element.addEventListener("DOMMouseScroll", function(event) { event.preventDefault(); }, false); else element.attachEvent("mousewheel", function() {

Speed up mouse wheel in jScrollPane (jQuery)

梦想的初衷 提交于 2019-12-03 06:12:18
I have a div with a fixed height and in it a ul-list and many li-items. I apply to the div a jScrollPane for which I want to customize the appearance of the scrollbar. My code is like: $(function() { $('.myDiv').jScrollPane( { showArrows: true, arrowScrollOnHover: true, wheelSpeed: 120 }); }); As jScrollPane I use the scripts of http://jscrollpane.kelvinluck.com and it is kind of working. But the speed of the mouse wheel (velocity of scrolling) is much too slow although I tried to set the speed up as you can see in my example above. Does anybody has had the same effect and can give me a hint