In this paper, we analyze the place where jquery uses height () to get a high degree of attention. Share to everyone for your reference. The specific analysis is as follows:
The jquery script is as follows:
Copy Code code as follows:
var anode = $ (' #demo ');
var height = anode.height (); If the anode is dis
Javascript:
Page visible area wide: document.body.clientWidth
Page visible Area High: document.body.clientHeight
Web page Visible area wide: document.body.offsetWidth (including edge width)
Page visible Area High: document.body.offsetHeight (including edge height)
Page body Full text width: document.body.scrollWidth
The full text of the Web page High: document.body.scrollHeight
Web pages are rolled up high: Document.body.scrollTop
Pages were r
This is a simple method, and you do not need to write anything to determine the browser height and width.
You can choose one of the following two methods. One is stored on the same page as iframe, and the other is stored on the test.html page.Be sure not to make the mistake.
IFRAMECode,Be sure to write the ID
Jquery code 1:
// Note: the following code is stored in test.html for calling.Vertex (w.w
($ (window). Height ()); Browser Current window viewable area heightAlert (document). Height ()); The height of the browser's current window documentAlert ($ (document.body). Height ()); The height of the body of the browser's current window documentAlert ($ (document.body)
Jquery obtains the code of the browser width and height:Visible area width of the webpage: Document. Body. clientwidthVisible area height: Document. Body. clientheightVisible area width of the webpage: Document. Body. offsetwidth (including the width of the edge)Visible area height of the webpage: Document. Body. offsetheight (including the
($ (window). Height ()); Browser Current window viewable area heightAlert (document). Height ()); The height of the browser's current window documentAlert ($ (document.body). Height ()); The height of the body of the browser's current window documentAlert ($ (document.body)
($ (window). Height ()); Browser Current window viewable area heightAlert (document). Height ()); The height of the Browser's current window documentAlert ($ (document.body). Height ()); The height of the body of the Browser's current window documentAlert ($ (document.body)
Get the size of the screen
I started to have a problem, I want to do a pop-up div layer, and then set the Z-index properties and height and width background color, etc.I'm using $ (document). Height (), $ (document). Width () to get the height and width of the window, but when you double-click the browser to change the size of the window, this
In jquery, there are 3 functions to get the height of an element, respectively, height (), innerheight (), Outerheight ().
Correspondingly, there are 3 functions to get the width of the element, respectively, width (), innerwidth (), Outerwidth ().
Here, we take the height (), innerheight (), Outerheight () 3 functio
The differences between the jQuery height (), innerheight (), and outerheight () functions are detailedIn jquery, there are 3 functions that get the height of an element, which are height (), innerheight (), and Outerheight ().Corresponding to this, there are 3 functions tha
How does jquery obtain the width and height of an element?
How does jquery obtain the width and height of an element:
This is of course a relatively basic problem, but it may not be clear for beginners. Here is a brief introduction.
Obtain the width of an element:
$ (Selector). width ()
Obtain the
One is implemented using jquery, which is done by downloading the jquery library.
The code is as follows
Copy Code
In IE 805Under the FF whether 787 Oh,
The two browsers are different because they display pixels because of the difference between browsing and padding and margin.
JS get browser height and width values
Page
Determine whether the image is a horizontal or vertical image based on the size of the inserted image. After judging the image, we will give you different display methods. The following describes how js and jquery obtain the true width and height of the image. 1. When do I need to obtain the true width and height of the image?
When creating a pc webpage, you may
Jquery retrieves the scroll bar height
Get the height of the display area of the browser: $ (window). Height ();
Obtain the width of the display area of the browser: $ (window). Width ();
Get the document height on the page: $ (document).
Gets the height of the browser display area: $ (window). Height ();Gets the width of the browser display area: $ (window). width ();Gets the document height of the page: $ (document). Height ();Gets the document width of the page: $ (documents). width ();Gets the vertical height
This article introduces Javascript and jquery code for obtaining various screen width and height. If you need it, refer to Javascript:
Visible area width of the webpage: document. body. clientWidth
Visible area height: document. body. clientHeight
Visible area width of the webpage: document. body. offsetWidth (including the width of the edge)
Visible area
, "": "outer" + name},function(Defaultextra, funcName) {//Margin is only for outerheight, Outerwidthjquery.fn[FuncName] =function(margin, value) {varchainable = Arguments.length (Defaultextra | |typeofMargin!== "Boolean"), Extra= Defaultextra | | (Margin = = =true|| Value = =true? "Margin": "Border" ); returnAccess This,function(Elem, type, value) {varDoc; if(Jquery.iswindow (elem)) {//as of 5/8/2012 this would yield incorrect results for Mobile Safari, but there //isn ' t a
Summary of differences between height (), innerheight (), and outerheight () in jQuery, jqueryouterheight
Suddenly we see outerheight () in the front-end jQuery code. The first thought is, what is this? Then I checked it carefully and found that there were many similar things.
In jQuery, there are three functions for r
To use JQuery to achieve two columns, such as high and adaptive height, in fact, is very simple, the principle is to obtain the left and right sides of the height, and then judge this value, the big value to the small on the line. Look at the code:$ (document). Ready (function() { var _leftheight = JQuery (". Left")
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.