JQuery's method of obtaining the width and height of document and window objects
This article mainly introduces jQuery's method of obtaining the width and height of document and window objects. It involves jQuery's technique of getting document and window object attributes.
This document describes how jQuery obtains the width and height of the document and window objects. Share it with you for your reference. The details are as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<! DOCTYPE html> <Html> <Head> <Script src = "js/jquery. min. js"> </Script> <Script> $ (Document). ready (function (){ $ ("Button"). click (function (){ Var txt = ""; Txt + = "Document width/height:" + $ (document). width (); Txt + = "x" + $ (document). height () + "\ n "; Txt + = "Window width/height:" + $ (window). width (); Txt + = "x" + $ (window). height (); Alert (txt ); }); }); </Script> </Head> <Body> <Button> Display dimensions of document and window </button> </Body> </Html> |
I hope this article will help you with jQuery programming.