Jquery get scroll y position

y is the variable that determines the position of the scroll, place it in the js $(document).scrollTop(y);. and then after reloading the. 1 › wnakswl › details › JjRrgjN. 2 CodePen doesn't work very well without JavaScript. We're all for progressive enhancement, but CodePen is a bit unique in that it's all about writing and showing. 3 Nuevo post para repasar la función de jQuery scrollTop(), su funcionalidad es la de obtener o establecer la posición vertical del scroll. 4 jQuery scrollTop () docs Description: Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element. nothing that works for my div, just the full page. 5 The method jQuery (v) uses to find this is: var doc = ntElement; var left = (ffset || Left) - (Left || 0); var top = (ffset || Top) - (Top || 0); That is: It tests for ffset first and uses that if it exists. 6 A scroll event is sent whenever the element's scroll position changes, regardless of the cause. A mouse click or drag on the scroll bar, dragging inside the element, pressing the arrow keys, or using the mouse's scroll wheel could cause this event. 7 In more technical terms, scrollY returns the Y coordinate of the top edge of the current viewport. If there is no viewport, the returned value is 0. Examples // make sure and go down to the second page if (Y) { (0, 0); // reset the scroll position to the top left of the document. } ByPages(1); Notes. 8 This method does not accept any arguments. The vertical scroll position is the same as the number of pixels that are hidden from view above the scrollable area. If the scroll bar is at the very top, or if the element is not scrollable, this number will be 0. Example: Get the scrollTop of a paragraph. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 9 To get the absolute position of the element, we need to add the current scroll position of the window to the left and top values using X and Y, respectively. Getting the X and Y Position in jQuery. In jQuery, we can use the offset() method to get the X and Y position of an HTML element. This method returns an object. jquery scroll to id 10