Resize Dynamically Built Iframe?
Oct 19, 2011I am building iframes from database entries. Is it possible to resize them with an onclick event?
View 1 RepliesI am building iframes from database entries. Is it possible to resize them with an onclick event?
View 1 Repliesknow how I can use JavaScript to find the size of my iFrame and feed it to Shadowbox to launch the appropriate sized shadowbox on different browsers and resolutions. For me, the parent page is called 'demo.html' and the iFrame is 'gallery/archive_iframe.html'.
Currently, the shadowbox is launched with a fixed height and width (which you will see in the HTML code below). The problem is that 'gallery/archive_iframe.html' displays differently on every browser and every resolution, causing unwanted horizontal and vertical scroll bars. An example can be seen here: [URL]
Here is the code that I use in 'demo.html' to launch the iFrame:
Head
Code:
<script type="text/javascript" src="/shadowbox/libraries/mediaplayer/jquery.js"></script>
<script type="text/javascript" src="/shadowbox/shadowbox.js"></script>
<script type="text/javascript" src='/shadowbox/libraries/mediaplayer/swfobject.js'></script>
[Code]....
What do I need to do in 'gallery/archive_iframe.html' if anything? My thought is that I need to wrap it in a DIV tag and find the width and height of that. And what do I need to do in 'demo.html'? I'd assume some code is needed to pull the dimensions discovered in my iframe document, and insert those into the link that launches Shadowbox.
To build a horizontal floating menu that matches the first row (header row) of my dynamically built table (to include text and cell height/width - needs to match exactly). I have accomplished 90% of this task by extracting the text and building the row in my floating menu header and placing the floating menu where it needs to be. However, I'm having a problem aligning the table (<TD></TD>) cells because of my dynamically built table.
Scenario:
I have a table that is built dynamically. Before it is displayed, I format the table row data (code that adds text/deletes rows etc…), which alters the width of all the table cells (via JavaScript). We'll call this (for lack of a better phrase) "pre_floater_table_format_code."
I then loop through the DOM (<TD></TD>) in the first row of the table to get the text and width from each cell (using offsetWidth and/or clientWidth) and assign the text and cell width(s) to variables that I use to build my floating menu with. We'll call this (for lack of a better phrase) "get_cell_text_width_code."
Problem:
The problem is that once the table is built (and before it is altered by the "pre_floater_table_format_code") it seems as though my "get_cell_text_width_code" reads the un-processed table cell width(s) and sets these variables to the un-processed width values. The "pre_floater_table_format_code" runs much earlier than the "get_cell_text_width_code." So why wouldn't the "get_cell_text_width_code" read the cell width(s) after they've been adjusted by the "pre_floater_table_format_code?" Does this make sense? Anyone have any recommendations? Alternative solutions?
Im trying to use javascript history to resize an iframe when a submit button is clicked inside the iframe.
This is what i found so far.
Code:
Us this with iframe:
Code:
Code:
But im not really sure on how to apply this to my iframe, and i know that the resize part also needs to be edited, but what is missing?
Is there a way to resize an iframe dynamically so that you never get the scroll bar and essentially hide that there is an iframe? Better integration really.Basically I want to iframe a forum into my site so that the design down the sides and top which my friend does using iweb are not messed with.We have a central area which can be longer or shorter depending on the forum.
View 3 Replies View RelatedI have a web page which will display another web page in an iframe. But the content inside the iframe may change while the user interacts with it so I need to be able to resize the iframe height from code on the page inside the iframe. Any tips on how I can do that? I am using php and javascript.
View 1 Replies View RelatedI am trying to dynamically resize an image. Here is my code:
<img border="0" src="images/right.gif" width="16" height="100" name="right">
<SCRIPT Language=Javascript>
<!--
function ChangeImgSize(){
[Code]....
The image does not get resized. I've been testing the page on current browsers (IE 8, Firefox, Chrome). I'm certain I'm doing something newbish, I don't really know Javascript all that well.
I need to adjust my IFrame Height based on srource page height (src) given for that IFrame.
I am getting it for the pages calling in the same domain like src='test.html', but I am not getting it when calling pages from other domains like src='http://someurl.com'.
My Page Looks like this:
<BODY>
<iframe src="http://someurl.com" name="NAME" scrolling="no" width="100%" frameborder="0" ></iframe>
</iframe>
</BODY>
It would be helpful if anyone suggest me a solution.
...Is it possible with Javascript? I have a Coldfusion template page which has on it three buttons that link to three more seperate Coldfusion template pages calling its content from a database. Since the content in these pages varies, my aim is to have the window resize itself to fit the content appropriately and negate having to use the scroll bars.
View 14 Replies View RelatedI've been able to get the iFrame to resize to the content - see this link - it's pretty simple. My only problem, is if the user clicks a link so that another page is displayed, the iFrame doesn't resize. It will only resize when the parent page is reloaded. So, not sure what to do about that.
(I do work with someone who writes Javascript and PHP, so they would know how to implement it if I found a solution).
Is there any way to resize the iframe automatically, so that it could obtain the original height and width of the page which is embedded in that iframe? I actually saw this function on PayPal but I don't remember its link.
View 1 Replies View RelatedHow does one use the onResize() event to dynamically resize a web page according to the size of the user's viewport?
View 10 Replies View Relatedi have an iframe on page to hold record editing form - the form presented in the frame needs to be different sizes depending on the form size i want the page called to resize the frame but, i can't figure out how to refer to it from the page loaded in the iframe parent().$("#myiframe").height( $("#formcontentwrapper").height() ) ;
View 1 Replies View RelatedI am using a WYSIWYG web editor (Serif WebPlus X4; for a whole range of reasons - please don't turn this thread into a discussion of the pros and cons of WYSIWYG! ). It has a tool to create a site search facility, whereby you add a text box to accept the search terms, and specify an iFrame in which the results appear. The source of the iFrame is not specified as a page, but rather the content is generated and inserted by the search JavaScript that runs when the user searches the page.
I really don't want the results to be in an iFrame, because I think it looks a mess when the page and the iFrame both scroll. To avoid this, I'm trying to get the iFrame to resize to fit the results, so it won't need to scroll. (Of course, the alternative would be to change the JavaScript so the results are placed directly onto a page rather than in an iFrame, but because of the way the WYSIWYG editor works, that's less straightforward).
I've found many scripts online that would let me change the size of the iFrame based on its content, but they all assume that the content is coming from a file saved on the server, and work by checking the height of the file's content, and inserting that value as the height of the iFrame. Now, the problem is that when I use these scripts they cause the iFrame to become 0px high, I assume because the frame doesn't have a fixed source that can be measured, but rather gets its content fed in from the search JavaScript.
Can anyone help me figure out a way to resize the frame even though its content is dynamically generated as the page with the frame is loaded? I've copied below the search script and the html page with the iFrame that needs to resize. Ideally, whatever solution I use shouldn't involve editing the .js file I've attached, since this is generated automatically by the WYSIWYG program.
[Code]...
I have an iframe on my page and I added the following code to detect the iframe file height to avoid scrolling which is working fine.
<script type="text/javascript">
function setIframeHeight(iframeName) {
//var iframeWin = window.frames[iframeName];
[code]....
There is a form in the iframe and it is coming from a third party web site which I have no access. My problem is when a client submits the search form in the iframe search results page is higher than the search main page and half of search results page is not shown. Is there a way to sense that the page in the iframe is changed and resize the iframe height accordingly?
I am trying to resize an external website in an iframe using javascript, but have not found code that works very well.
View 5 Replies View RelatedI'm using some javascript that senses the presence of an id on a page, creates an iframe containing cross domain content if it finds it and also resizes the iframe. It works great in FF, but IE stumbles if there's more than one iframe requested (especially IE6). If someone knows a better way to get IE to co-operate with this set up An acceptable alternative would be to only create one iframe at a time (which IE can handle), by using a link to trigger the iframe creation. I just can't figure out how to get that to work.The cross domain resizer uses the frame manager trick, the rest is homespun.
Code:
<!--JS THAT RESIZES IFRAMES-->
<script type="text/javascript" src="documents/FrameManager.js"></script>
</script>
<!--POSTS-->
<script>
[Code]...
Code:
function resizeIframe(win)
{
var iwin;
while(win.parent != null && win.parent != win)
[Code]....
I want to write a code, which dynamically resize iframes to remove srollbars. I have iframe, I go to its parent..which might be another iframe inside some parrent.. I will loop till i resize all iframes.. someone got a fix?
here is my script that works just fine in IE. Onload I want the iframe to resize to the content loaded within it:
[Code]...
Error: document.getElementById("loadapi").contentWindow.document.body is undefined
An example of the resizing of an image can be seen here as well as at most photography galleries that are full-screen. You can see the size of the image change by shrinking your browser window. I want to make that gallery using javascript. I already have the ability to make a horizontal slider with left/right navigation - that part is easy. I just have never done anything with dynamic image sizes.One thing that was brought up to me already was the ability to shrink the browser window to fit.
View 2 Replies View Relatedcompare the original code with mine before I explain the issue:
jquery waypoint demo:
Code:
$(document).ready(function() {
$('.top').addClass('hidden');
$.waypoints.settings.scrollThrottle = 30;
[Code]....
The issue: the sticky class is added. Fine. But when I resize the window, it disappears, which does not happen with waypoint original demo.
I thought that maybe the problem could be that #nav parent element is <body>. But the same issue exists if I add a #wrapper div.
Can anyone help me figure what kind of criteria I should use to search this forum for a clue as to my dilema?
View 2 Replies View RelatedIve written some code to try and resize a page dependant on the content oof an iframe. Code is as follows:
window.onload=sizeAdj();
function sizeAdj() {
var elFrame = document.getElementById('theFrame');
var elTable = document.getElementById('tableGrab');
var elDivMain = document.getElementById('main');
var elDivWrapper = document.getElementById('wrapper');
[Code]....
I originally thought that I would just be able to resize the iframe and the other elements would follow suit but as you can see Ive tried to resize the other encasing elements also. The code resizes partially in chrome but only to a certain point and not to the full height of the doc content.
I have been having an issue with this script to resize my iframe(ifr) based on the content loaded in it.I am half bald from this issue. Works perfect in IE7 & 8 but not in FF or Chrome.FF works "almost" - It resizes on first page loaded but doesn't resize if the iframe content is changed until refreshed. (example: If I load search results which shows 10 results and then click one and it loads the page which isn't as high as the search results page was then it just stays at the larger height until I refresh and then resizes correctly.)
.JS Code:
/***********************************************
* IFrame SSI script II- � Dynamic Drive DHTML code library (http://www.dynamicdrive.com)[code]....
I'm using this script as an auto resize function for an iframe, but can't get it to work in safari.
<script type="text/javascript">
<!--
function calcheight(){
var the_iframe = document.getElementById('paymentHistory');
var the_document = (the_iframe.contentWindow - the_iframe.contentDocument);
if(the_document.document) the_document = the_document.document;
var the_height= the_document.body.scrollHeight;}
//-->
</script>
To call the function, I have
<iframe id="paymentHistory" onload="calcHeight()" src="/andy/admin/categories/printpaymenthistory.php"></iframe>
Just working on this page - [URL]
In Opera, the dynamic resize of the iframe isn't working correctly. As you can see in the code, I have set a minimum height of 200px so the iFrame should always be a minimum height but if the content requires it will increase. It works fine in IE8, Safari, FF, Chrome but not in Opera. In Opera it just sets the height at 200px.