Home > Web Front-end > JS Tutorial > body text

How jQuery calculates iframe window width and height

php中世界最好的语言
Release: 2018-04-26 15:23:30
Original
2000 people have browsed it

This time I will show you how jQuery calculates the width and height of the iframe window. What are the precautions for jQuery to calculate the width and height of the iframe window. The following is a practical case, let's take a look.

<iframe id="aaax" src="" scrolling="no" frameborder="0" style="
display
:none"></iframe> 
<script language="
javascript
" type="text/javascript"> 
$(function () { 
var $main = $("#main").height(); 
var $searchPanel = $("#searchPanel").height(); 
var $listArea = $("#listArea").height(); 
$("#aaax").height($(window).height() - $main - $searchPanel - $listArea + 180); 
var $aaax = $("#aaax").height(); 
if ($aaax < 282) { $("#aaax").height(300); } 
else { $("#aaax").height($(window).height() - $main - $searchPanel - $listArea + 180); } 
var $chartArea = $("#chartArea").width(); 
var $chartAreaLeft = $(".chartAreaLeft").width(); 
$("#aaax").width($chartArea - $chartAreaLeft - 10); 
var $aaaxWidth = $("#aaax").width(); 
if ($aaaxWidth < 597) { $("#aaax").width(500); } 
else { $("#aaax").width($chartArea - $chartAreaLeft - 10); } 
}); 
</script>
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

jQuery cross-domain operation DOM method in iframe

JSONP solves ajax cross-domain problem (with code )

php jquery passing json data implementation method

The above is the detailed content of How jQuery calculates iframe window width and height. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template