Home > Web Front-end > JS Tutorial > Teach you how to use jquery to implement iframe adaptive height_jquery

Teach you how to use jquery to implement iframe adaptive height_jquery

WBOY
Release: 2016-05-16 16:45:00
Original
1424 people have browsed it

iframe code, pay attention to write ID

Copy code The code is as follows:




jquery code one:

Copy code The code is as follows:

//Note: The following code is placed in test. html calls
$(window.parent.document).find("#main").load(function(){
var main = $(window.parent.document).find("#main") ;
var thisheight = $(document).height() 30;
main.height(thisheight);
});


jquery code two:

Copy code The code is as follows:

//Note: The following code is placed Call
$("#main").load(function(){
var mainheight = $(this).contents().find("body").height() 30;
$(this).height(mainheight);
});
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