1. The distance from the top of the window where the current scroll is to the top of the entire page:
var winPos = $(window).scrollTop();
2. Get the page position of the specified element:
$(val).offset().top;
3. Monitor the rolling of the page scroll bar: place it when the page is loading
$(window).scroll(function(event)});
4. Set the scroll bar to the specified position.
$(window).scrollTop(offset)。
##5,jQuery('#item'). The actual size of outerHeight()
#item, that is, height+padding+border##6, jQuery('#item').outerHeight(true)
#The actual size and margin of the item, that is, height+padding+border+margin
Related recommendations:
The problem of calculating the visual distance height in JS[Front-end] Summary of methods to determine whether an element is within the visible rangejs gets the width and height of the visual area and bodyThe above is the detailed content of Summary of methods for js visual distance. For more information, please follow other related articles on the PHP Chinese website!