Results 1 to 2 of 2

Thread: Resize iFrame based on Content

  1. #1
    Join Date
    Feb 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Resize iFrame based on Content

    So i'm trying to create a sharepoint web part via a Content Editor Web Part. I'm pasting in the following code. The purpose of the code is to be able to edit the &Date= + &EndDate= variables in the URL so that the page loads based on the current day. My function just gets the day, and formats it and shoves it into the url src of the iFrame.

    The problem i'm running into is that i want to dynamically change the height of the iFrame based on the content. I've tried a few different approches and nothing seems to work. height="100%" doesnt work within the iframe tag. And the functions i've created using onLoad do not seem to work either. Does anyone have ideas for how to get this working?

    here is the code i have so far:


    <script langauge="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
    <script language="javascript">

    var $j=jQuery.noConflict();

    $j(document).ready(function()
    {
    var d = new Date();
    var curr_date = d.getDate();
    var curr_month = d.getMonth();
    curr_month++;
    var curr_year = d.getFullYear();
    var formattedDate= curr_month + "/" + curr_date + "/" + curr_year;
    $j("#myiframe").attr("src","http://www.whatever.asp?Date=" + formattedDate + "&EndDate=" + formattedDate + "&status=whatever");
    });

    </script>

    <iframe id="myiframe" width="100%" scrolling="yes" frameborder="0"></iframe>

  2. #2
    Join Date
    Feb 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    havent heard back from anyone yet so i'm going to go ahead and post a comment to bump myself up on the list.

    What i'm trying to do here is get the scrollHeight from the following URL so i can then pass the scrollHeight to the iFrame:

    $j("#myiframe").attr("src","http://www.whatever.asp?Date=" + formattedDate + "&EndDate=" + formattedDate + "&status=whatever");

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •