Home  >  Article  >  Web Front-end  >  Summary of methods for js visual distance

Summary of methods for js visual distance

零到壹度
零到壹度Original
2018-03-24 14:50:051748browse


This time I will summarize the knowledge points about js visual distance. The following is the specific content. Let’s follow the editor to take a look.

JQuery monitoring page scrolling summary

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 range

js gets the width and height of the visual area and body

The 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn