cfwindow to open vertically centered, even when scrolling

I have a long list of data in a table.   When clicking on a row, I use cfwindow to pop-up more information about the clicked item.

The problem is that when the user scrolls down the page, cfwindow pops open the window way up at the top of the page, out of view and the user doesn't know it has opened.  So I need the pop-up window to open (or reposition) to where the center of the screen vertically, even if the user has scrolled down the page.

It seems that cfwindow will open pretty well the first time, but will always re-open to that same location each time after the first one.   So I may have to move it after open.  

Thanks for any ideas!
LVL 39
gdemariaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott BennettManager TechnologyCommented:
Here is a little javaScript function I created to do what you want. There is a lot you can do with the underlying Ext object that Adobe used to create the cfwindow functionality. There are more examples in this article on my Blog:

http://www.coldfusionguy.com/ColdFusion/blog/index.cfm/2007/12/4/CF8-AJAX-Features-Enhancing-CFWindow-with-JavaScript
<script language="JavaScript">
centerWindow = function(windowName){
//Get window object
myWindow = ColdFusion.Window.getWindowObject(windowName);
 
//use the centerfunction to center the window.
myWindow.center();
 
}
</script>
 
 
<a href="javascript:ColdFusion.Window.show('mywindow');centerWindow('mywindow');">Click here for more info</a>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<a href="javascript:ColdFusion.Window.show('mywindow');centerWindow('mywindow');">Click here for more info</a>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<a href="javascript:ColdFusion.Window.show('mywindow');centerWindow('mywindow');">Click here for more info</a>
<cfwindow name="mywindow" initshow="false">
	<table width="100%"><tr><td align="center" valign="middle">Here is some more info. </td></tr></table>
</cfwindow>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gdemariaAuthor Commented:
Fantastic!  Thanks very much
0
theideabulbCommented:
Just want to say thank you for the script.  I was running into this issue as well and this worked great!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.