mousewheel

How do I suppress window mouse wheel scrolling…?

冷暖自知 提交于 2020-01-01 02:48:08
问题 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?! 回答1: 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",

Smooth vertical scrolling on mouse wheel in vanilla javascript?

安稳与你 提交于 2019-12-31 10:47:21
问题 I am a huge fan for vanilla javascript, currently I am working on a project where I need to implement smooth scrolling on mouse wheel scroll. I want to implement this using vanilla JS. I found a jQuery snippet on doing some research which go like below. $(window).on('mousewheel DOMMouseScroll', function(e) { var dir, amt = 100; e.preventDefault(); if(e.type === 'mousewheel') { dir = e.originalEvent.wheelDelta > 0 ? '-=' : '+='; } else { dir = e.originalEvent.detail < 0 ? '-=' : '+='; } $(

disable mouse wheel scrolling while cursor over flex app?

被刻印的时光 ゝ 提交于 2019-12-30 07:19:16
问题 Is it possible to disable mousewheel scrolling on my webpage while the cursor is over my flex application? My flex application is a map that allows user to zoom in and out using the mousewheel; however, when I put my flex app onto my webpage, the scrollwheel causes the page to scroll instead of zooming in and out... Edit: I have added sounds to my flex app and it tells me my mouse events are correct. I have also added an alertbox to the javascript so that I know the MyApp.initialize function

MouseWheel in Chrome and Firefox

两盒软妹~` 提交于 2019-12-29 04:26:07
问题 I'm trying to handle the mouseWheel event in an advancedDataGrid with not success. Without any additional code my adg can be scrolled with the mouse in IE but not in firefox and Chrome, why? Why does it behave different in those browsers? Then I tried this code but it does not work: protected function adgMouseWheelHandler(event:MouseEvent):void { event.delta = event.delta > 0 ? 1 : -1; } and then setting the event mouseWheel in my adg like this: <mx:AdvancedDataGrid id="myADG" width="100%"

MouseWheel in Chrome and Firefox

≡放荡痞女 提交于 2019-12-29 04:26:02
问题 I'm trying to handle the mouseWheel event in an advancedDataGrid with not success. Without any additional code my adg can be scrolled with the mouse in IE but not in firefox and Chrome, why? Why does it behave different in those browsers? Then I tried this code but it does not work: protected function adgMouseWheelHandler(event:MouseEvent):void { event.delta = event.delta > 0 ? 1 : -1; } and then setting the event mouseWheel in my adg like this: <mx:AdvancedDataGrid id="myADG" width="100%"

How to prevent page scrolling when scrolling a DIV element?

懵懂的女人 提交于 2019-12-27 12:08:47
问题 I have reviewed and tested the various functions for preventing the body ability to scroll whilst inside a div and have combined a function that should work. $('.scrollable').mouseenter(function() { $('body').bind('mousewheel DOMMouseScroll', function() { return false; }); $(this).bind('mousewheel DOMMouseScroll', function() { return true; }); }); $('.scrollable').mouseleave(function() { $('body').bind('mousewheel DOMMouseScroll', function() { return true; }); }); This is stopping all

【js杂记】js、jquery实战杂记 1

ⅰ亾dé卋堺 提交于 2019-12-25 12:31:49
1、jquery中event.originalEvent属性 该方法的作用是指向原始的事件对象 2、JS滚轮事件(mousewheel/DOMMouseScroll) IE、Chrome:mousewheel FireFox:DOMMouseScroll IE、Chrome:event.wheelDelta(向下滚动为负值) FireFox:event.detail(向下滚动为正值) $(document).bind({ // Mouse Scroll // IE、Chrome:mousewheel // FireFox:DOMMouseScroll 'mousewheel DOMMouseScroll' : function(e) { var delta = e.originalEvent.wheelDelta || - e.originalEvent.detail, time = new Date().getTime(); if(time - scroll_screen.lastTime < 1000) { return; } scroll_screen.move(delta); //if( delta < 0 ){ // next scroll_screen.lastTime = time; } }); 3、jquery右键事件 contextmenu 4、监听输入框

stop mousewheel's continued effect

断了今生、忘了曾经 提交于 2019-12-25 07:49:26
问题 How can I stop this effect: I'm scrolling in a div using the mousewheel, and when I reach the bottom of the scroll content, then mousewheel continues the scrolling on the body (or on the first scrollable element, that wraps my div). 回答1: This continuum scroll also bothers me on websites.. The theory would be something as: The element you want to scroll, must have an JavaScript event listener of scroll attached to it, so when the scroll is at zero and the user scrolls up you OR the element is

as3 mouse wheel reverse

断了今生、忘了曾经 提交于 2019-12-25 01:58:04
问题 Hey i built custom scroll box. When i scroll up on this box scrolling element is going down and when i scroll down - scrolling element is going up ;). I whant to reverse that mechanism. how can i do it ? Below my code for mouse import flash.events.MouseEvent; function handleMouseWheel(event:MouseEvent):void { if ((event.delta > 0 && box_mc.y < 171) || (event.delta < 0 && box_mc.y > 135)) { box_mc.y = box_mc.y + (event.delta * 3); sb.thumb.y = sb.thumb.y + (event.delta * 13); trace(box_mc.y);

javascript MouseWheel event & video volume - prevent page scroll

我是研究僧i 提交于 2019-12-25 01:09:40
问题 I'm trying to control a video volume using the MouseWheel, I want to completely disable the page scroll when my mouse is over the video, it works but there's a problem when the video's volume reaches the min & max levels: the page scroll begins...and I don't want the page scroll if my mouse is over the video! Actually I'm trying it in chrome: var popo = document.getElementById('popo'); var coco = document.getElementById('coco'); //popo.play(); //setTimeout(function(){ // popo.pause(); //}