Is it possible to get a window popup with always 400px wide, but dynamic height depending on the content in the popup window?
I have seen this but not sure how to apply it to popup windows
Is it possible to get a window popup with always 400px wide, but dynamic height depending on the content in the popup window?
I have seen this but not sure how to apply it to popup windows
Well, since you're relying on JavaScript to popup, you could do this... You've tagged jQuery, so here is a start... Place this in the popup.
$(document).ready(function() {
var popupHeight = parseInt($('#elementThatWillGetTaller').css('height')); // parseInt if we get a '200px'
// code to set window height - I know it can be done because I've seen osCommerce do it
});
The quickest solution would be to know the height of the window prior to opening it. If you know that then you can pass that as a parameter to the function that opens the popup window thus making the popup the correct height.
Solved
$(document).ready(function() {
// For IE
var h = $('#page').outerHeight();
var newH = h + 20;
window.resizeBy(0, newH - $(window).height());
// Only works in Firefox/Safari
$('img').load(function() {
var h = $('#page').outerHeight();
var newH = h + 20;
window.resizeBy(0, newH - $(window).height());
});
});
If you specify overflow: auto and do not specify a height on an element, that element should grow in height dynamically.