function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdc-apexsfdc-apex 

how to display a visualforce page in home page whose height should vary dynamically

Hi,
 
I'm using a visual force page in a home page component.But height remains as I specified and if onlw few records are retrieved  blank space is coming up between the components.
I dont want to use scrolling option.So how can I vary the height dynamically based on the number of records.
 
the html i'm using for my component is below..
 
<IFRAME id=VisualForceLeads name=VisualForceLeads src="/apex/testLead" frameBorder=0 width="100%" scrolling=no height=1000></IFRAME>
 
Any pointers regarding this will be of great help.
Thanks in advance..
yogesh.rankawatyogesh.rankawat
Use following javascript to resize iframe :

  function resizeIframe () {
    var me = window.name;
    var height = 0;

    if (me) {
      var iframes = parent.document.getElementsByName(me);
      if (iframes && iframes.length == 1) {
        height = document.body.offsetHeight;

        if (height > 32768) {
          // Maximum iframe height is 32768. Setting any larger value will result in a very large
          // parent window height, and still a scrollbar on the iframe itself. The bottom of the window
          // will be a huge expanse of blankness. It's pretty ugly.
          height = 32768;
        }
          iframes[0].style.height = height + "px";
      }
    }
  }

:smileyhappy:
sfdc-apexsfdc-apex
hi Yogesh,
 
Thanks a ton for the reply.
But where do I have to incotporate this java script.This should be executed on load,but I dont find any way to execute this on load of the visual force.
 
Thanks and Regards,
Sushmitha
Jack InsJack Ins

Hi,

I tried using this code to make a home page component dynamic but it is not working.  Can I get some help with it please?

 

<IFRAME id=MessageBoard name=MessageBoard src="/apex/MessageBoard" frameBorder=0 width="100%" scrolling=yes height=235>
function resizeIframe () {
    var me = window.name;
    var height = 0;

    if (me) {
      var iframes = parent.document.getElementsByName(me);
      if (iframes && iframes.length == 1) {
        height = document.body.offsetHeight;

        if (height > 32768) {
          // Maximum iframe height is 32768. Setting any larger value will result in a very large
          // parent window height, and still a scrollbar on the iframe itself. The bottom of the window
          // will be a huge expanse of blankness. It's pretty ugly.
          height = 32768;
        }
          iframes[0].style.height = height + "px";
      }
    }
  }
</IFRAME>