Skip to main content
July 31, 2009
Question

Resize CFWindow when reloading

  • July 31, 2009
  • 1 reply
  • 1314 views

I have a 2 pages, the first is a thumbnail list page which creates a cfwindow of the second page (a large thumnail with the same images underneath it).

When I select one of the thumnails in the cfwindow, it refreshes the page, takes the url information and calls a query to retrieve the thumnails, and set the fullsize image to the one clicked.

Here is a cfwindow looks like to give you a better understanding

cfwindow_resize.gif

(please excuse the beautiful skinning I have done)..

My problem

My images are different sizes so I will need to resize the cfwindow everytime I reload it. I have tried these attempts

setContentSize() & resizeTo(). Now I am using this in my cfwindow, and when i created my cfwindow I called it 'fullimage' I would assume, that I could use 'this' or 'fullimage' as the name of my object.

<script language="JavaScript">
   resizeWindow = function(width,height){
      //Get window object  
     myWindow = ColdFusion.Window.getWindowObject(this);

     
      //use the setContentSize function to resize the window.      
      fullimage.setContentSize(width, height);
     
   }
</script>

And then on the body tag I do this

<body onload="resizeWindow('<cfoutput>#url.width#</cfoutput>',

'<cfoutput>#url.height#</cfoutput>')">

    This topic has been closed for replies.

    1 reply

    WolfShade
    Legend
    August 1, 2009

    Instead of reloading the window every time a thumbnail is clicked, why not load all the images into an array on the page load, then use Javascript to a) load the first image by default, and b) dynamically load the respective larger image when a thumb is clicked.  This way, you can get all the image dimensions at once and size the window for the largest one.  I believe DreamWeaver has a built-in template for pre-loading the images.

    ^_^

    August 3, 2009

    Yes, I quickly figured this out right after I posted, but I actually went further and created tooltips that have the fullsize image in it. its less hassle too. I would still like to find out how to reload a page that is in a cfwindow and resize the cfwindow itself.