Set height for iFrame using jquery
$(document).ready(function () {
var height = $(window.frameElement).height(); // Calculate the window height
var minheight = $(window.frameElement).height(); // Calculate the window min-height
$(window.top.document).find('iframe').css("height", (height - 20) + "px"); // Calculated window height - header height + footer height + padding + margin , then you will get the remaining height for the main container
$(window.top.document).find('iframe').css("min-height", (minheight - 20) + "px"); // Calculated window minheight - header height + footer height + padding + margin , then you will get the remaining min-height for the main container
$(window.top.document).find('iframe').css("width", "100%");
});
// Resize Function
$(window).resize(function () {
var height = $(window.frameElement).height(); // Calculate the window height
var minheight = $(window.frameElement).height(); // Calculate the window min-height
$(window.top.document).find('iframe').css("height", (height - 20) + "px"); // Calculated window height - header height + footer height + padding + margin , then you will get the remaining height for the main container
$(window.top.document).find('iframe').css("min-height", (minheight - 20) + "px"); // Calculated window minheight - header height + footer height + padding + margin , then you will get the remaining min-height for the main container
});
var height = $(window.frameElement).height(); // Calculate the window height
var minheight = $(window.frameElement).height(); // Calculate the window min-height
$(window.top.document).find('iframe').css("height", (height - 20) + "px"); // Calculated window height - header height + footer height + padding + margin , then you will get the remaining height for the main container
$(window.top.document).find('iframe').css("min-height", (minheight - 20) + "px"); // Calculated window minheight - header height + footer height + padding + margin , then you will get the remaining min-height for the main container
$(window.top.document).find('iframe').css("width", "100%");
});
// Resize Function
$(window).resize(function () {
var height = $(window.frameElement).height(); // Calculate the window height
var minheight = $(window.frameElement).height(); // Calculate the window min-height
$(window.top.document).find('iframe').css("height", (height - 20) + "px"); // Calculated window height - header height + footer height + padding + margin , then you will get the remaining height for the main container
$(window.top.document).find('iframe').css("min-height", (minheight - 20) + "px"); // Calculated window minheight - header height + footer height + padding + margin , then you will get the remaining min-height for the main container
});
Subscribe to:
Posts
(
Atom
)
15 comments :
Post a Comment