logo
down
shadow

Cant get wheel scroll delta on Firefox


Cant get wheel scroll delta on Firefox

Content Index :

Cant get wheel scroll delta on Firefox
Tag : javascript , By : zdyne
Date : November 24 2020, 03:01 PM

wish of those help For WheelEvent, what you are looking for is called deltaX, deltaY and deltaZ.
There is no wheelDelta property, which belongs to an early draft chrome made called MouseWheelEvent but which never made its way to the specs.
document.onwheel = e => pre.textContent = e.deltaY;
body{
  height: 600vh;
  }
pre{
  position: fixed;
  }
<pre id="pre"></pre>

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Android wheel scroll second wheel when the first is scrolled


Tag : java , By : mansoor
Date : March 29 2020, 07:55 AM
With these it helps I think the best solution is to use a flag to skip duplicated events from the wheels; something like next:
changedlistener = new OnWheelChangedListener() {
   boolean inProgress = false;

   public void onChanged(WheelView wheel, int oldValue, int newValue) {

     if (!inProgress) {
         return;
     }
     inProgress = true;

     try {
         if (wheel.getId() == R.id.month || wheel.getId() == R.id.day || wheel.getId() == R.id.year) {
             updateDays(year, month, day);
         } else if (wheel.getId() == R.id.hijrimonth || wheel.getId() == R.id.hijriday || wheel.getId() == R.id.hijriyear) {
             hijriDays(hijriyear, hijrimonth, hijriday);
         }
      }
      finally {
          inProgress = false;
      }
   }
};

cross browser mouse wheel, to scroll 100% browser height by one single wheel


Tag : javascript , By : Rohii
Date : March 29 2020, 07:55 AM
I hope this helps you . Have some js , I use mouswheel.js and I do it! :) may be useful for someone
$(document).ready(function(){
var winHeight = window.innerHeight ?
            function() {
                return window.innerHeight;
            } :
            function() {
                return document.documentElement.clientHeight;
            };
$('.first-block').height(winHeight);
var BlockHeight = $('.first-block').height();
$.browser = {};
$.browser.mozilla = /mozilla/.test(navigator.userAgent.toLowerCase()) &&     !/webkit/.test(navigator.userAgent.toLowerCase());
if($.browser.mozilla)
{
 var ScrollType = 'html';
  }
else
   {
 var ScrollType = 'body';
  }
$('.first-block').mousewheel(function(event, delta, deltaX, deltaY) {
  if((delta<0) && ($(ScrollType).scrollTop()==0)) $(ScrollType).animate({ scrollTop: BlockHeight-    104 }, 600);
});

$(ScrollType).keydown(function(event){
 if((event.keyCode==40) && ($(ScrollType).scrollTop()==0)) $(ScrollType).animate({ scrollTop:  BlockHeight-104 }, 600);
})

});

jQuery scroll event: how to determine amount scrolled (scroll delta) in pixels?


Tag : javascript , By : ralph okochu
Date : March 29 2020, 07:55 AM
Any of those help The "scroll value" does not depend on the window size or screen resolution. The "scroll value" is simply the number of pixels scrolled.
However, whether you are able to scroll at all, and the amount you can scroll is based on available real estate for the container and the dimensions of the content within the container (in this case the container is document.documentElement, or document.body for older browsers).
// custom 'scrolldelta' event extends 'scroll' event
jQuery.event.special.scrolldelta = {
    delegateType: "scroll",
    bindType: "scroll",
    handle: function (event) {
        var handleObj = event.handleObj;
        var targetData = jQuery.data(event.target);
        var ret = null;
        var elem = event.target;
        var isDoc = elem === document;
        var oldTop = targetData.top || 0;
        var oldLeft = targetData.left || 0;
        targetData.top = isDoc ? elem.documentElement.scrollTop + elem.body.scrollTop : elem.scrollTop;
        targetData.left = isDoc ? elem.documentElement.scrollLeft + elem.body.scrollLeft : elem.scrollLeft;
        event.scrollTopDelta = targetData.top - oldTop;
        event.scrollTop = targetData.top;
        event.scrollLeftDelta = targetData.left - oldLeft;
        event.scrollLeft = targetData.left;
        event.type = handleObj.origType;
        ret = handleObj.handler.apply(this, arguments);
        event.type = handleObj.type;
        return ret;
    }
};

// bind to custom 'scrolldelta' event
$(window).on('scrolldelta', function (e) {
    var top = e.scrollTop;
    var topDelta = e.scrollTopDelta;
    var left = e.scrollLeft;
    var leftDelta = e.scrollLeftDelta;
  // do stuff with the above info; for now just display it to user
    var feedbackText = 'scrollTop: ' + top.toString() + 'px (' + (topDelta >= 0 ? '+' : '') + topDelta.toString() + 'px), scrollLeft: ' + left.toString() + 'px (' + (leftDelta >= 0 ? '+' : '') + leftDelta.toString() + 'px)';
    document.getElementById('feedback').innerHTML = feedbackText;
});
#content {
    /* make window tall enough for vertical scroll */
    height: 2000px;
    /* make window wide enough for horizontal scroll */
    width: 2000px;
    /* visualization of scrollable content */
    background-color: blue;
}
#feedback {
    border:2px solid red;
    padding: 4px;
    color: black;
    position: fixed;
    top: 0;
    height: 20px;
    background-color: #fff;
    font-family:'Segoe UI', 'Arial';
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='feedback'>scrollTop: 0px, scrollLeft: 0px</div>
<div id='content'></div>

How to write mouse wheel scroll event when wheel (middle) button held down?


Tag : vb.net , By : user183442
Date : March 29 2020, 07:55 AM
To fix this issue You need to handle more than one event. You need to capture the MouseWheel event and the MouseDown/MouseUP events.
Private mouseDown As Boolean = False
Private Sub Form1_MouseWheel(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel
    If e.Delta > 0 And mouseDown Then
        Console.WriteLine("Scrolling with button down")
    Else
        Console.WriteLine("Button Not down whilst scrolling")
    End If
End Sub

Private Sub Form1_MouseDown(sender As Object, e As MouseEventArgs) Handles MyBase.MouseDown
    If e.Button = MouseButtons.Middle Then
        mouseDown = True
    End If
End Sub

Private Sub Form1_MouseUp(sender As Object, e As MouseEventArgs) Handles MyBase.MouseUp
    If e.Button = MouseButtons.Middle Then mouseDown = False
End Sub

infinite scroll firing too quickly with cursor, but fine with space bar or scroll wheel


Tag : reactjs , By : user185751
Date : March 29 2020, 07:55 AM
Does that help I'm trying to learn React by implementing a custom infinite scroll. , You could set a flag, say allowScroll:
constructor(props) {
    super(props);

    this.state = {
        visibleStart: 0,
        visibleEnd: 20,
        diff: 20
    };

    this.allowScroll = true;
}
handleScroll(event) {
    if (!this.allowScroll) {
        return;
    }

    this.allowScroll = false;

    setTimeout(function() {
        this.allowScroll = true;
    }, 1000);

    // ...

 }
Related Posts Related QUESTIONS :
  • Why several clicks fire for each instance of a Class?
  • cant grab value from div using attr()
  • Make web service not accessible by browser?
  • Select DOM elements within template
  • How to customize angular ui-grid row background color?
  • Binding data in two respective $scope in AngularJS, how?
  • react put some props after import class
  • Variable is distributed among same components
  • switch class in jQuery/JavaScript for active/inactive state
  • How To Track Outbound Clicks Using Javascript
  • How to get total seconds elapsed since the beginning of the month?
  • Protractor: Stale element reference at "browser.wait(EC.visibilityOf(confDial), FIFTY_SECONDS);"
  • Access to an array inside an object
  • Reseting an JavaScript Interval with different value?
  • Learning Angular for the first time - version 2 or 4?
  • Rendering RSS feed (XML) in React with jquery, why do object values parsed from the feed seem empty?
  • Node.js xml2js http.request tag matching
  • applying texture to custom plane geometry in Threejs
  • How do I pass an Event as a function parameter in HTML written inside JavaScript variable?
  • Interface of object parameter with default value and default property
  • Does using try / catch rather than `.catch` observable operator with XHR requests reduce performance?
  • In IE11 background colors not working on printing
  • TypeScript interface signature "(): string"
  • Is synchronous XMLHttpRequest supported in Internet Explorer 10 and 11?
  • Axios function not returning any values with js
  • How to use firestore TIMESTAMP to create time-stamp in JavaScript
  • Instantiate subclass without constructing
  • Outputing a created object in javascript to a server side JSON file
  • Transition the numeric labels in a bar chart
  • createBottomTabNavigator: hide just one tab from the tabBar
  • iife vs simple statement behavior with document.title
  • showDialogPopup Refresh Page after Click
  • Child component does not set the initial value passed from the parent: ReactJS
  • Nodejs javascript added to button not responding
  • Trying to define a promise.all
  • Python GEE to extract featurecollection timeseries from Landsat imageries
  • How to write negative binary number?
  • Unable to set property of individual object
  • Why Named Function Expression itself cannot assign Name to another Value?
  • How to reset scroll position on single page pagination
  • How to scroll to bottom of page, when a new message is sent - Socket.io
  • How to reconstruct audio blob from a base64 encoded String?
  • How to calculate numbers within an array of objects
  • Using JavaScript to change CSS properties of SVG circles for all circles that was not clicked
  • Is there value in propTypeing repeat required properties at every level of nested components?
  • Call function if variable does not exist in a filter
  • localStorage value doesn't get updated automatically
  • React not updating state with setState correctly inside promises
  • Direct native JavaScript or jQuery method to get containing block of an element
  • Dynamic JSON object to Html Table
  • How to send Id and file to same controller?
  • How to Make a jQuery Table Cell(td) clickable to Run a Function?
  • Prevent the duplicate function onchange event jQuery
  • Reactjs Input Upload doesn't return local URL
  • An unexpected 'StartObject' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected
  • How to filter a JSON Array, with an eventListener input value at keyup
  • How to separate the different properties of filter in css?
  • Why dont work change event of bootstrap input spinner?
  • How to hide overflow text content in react
  • Is there another way to write line 6
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com