You want to get the width and height of the window and document in pixels.
jQuery’s width and height methods provide easy access to the basic dimensions of the window or document:
It’s important to understand that the width and height of the document can (and likely will) be different from the width and height of the window. The dimensions of the window refer to the size of the view port—that portion of the browser that is available for displaying a document. The dimensions of the document refer to the size of the document itself. In most cases, the document height will be taller than the window’s height. The document’s width will always be at least the window’s width but may be greater than the window’s width. In Figure (The document size and the window size are often different),
jQuery('body').width() <jQuery(document).width(), and jQuery(document).width() == jQuery(window).width(). If the body were wider than the window, the document width would increase accordingly.
The width and height methods can also accept arguments if you want to set the dimensions of an element. The argument can be provided as an integer—in which case it will be interpreted as a pixel measurement—or as a string, in which case it is interpreted as a CSS-like measurement (i.e., $('#foo').width('300px')).
J Query Related Interview Questions
|HTML 4 Interview Questions||HTML Interview Questions|
|HTML 5 Interview Questions||Zend Interview Questions|
|JqueryUI Interview Questions||Dynamic HTML Interview Questions|
|XQuery Interview Questions||jQuery Mobile Interview Questions|
J Query Related Practice Tests
|HTML 4 Practice Tests||HTML Practice Tests|
|HTML 5 Practice Tests||Zend Practice Tests|
|PHP and Jquery Practice Tests||J Query Practice Tests|
|CodeIgniter Practice Tests||Dynamic HTML Practice Tests|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.