Guest Posted March 16, 2008 Posted March 16, 2008 Everyone is so great with offering help I was wondering if someone could also help me with this problem please? I would like the image in my pop-up window to be in the center of the window instead of in the left hand side of the window. I have looked at catalog/popup_image.php and I think that something needs to be changed to achieve that but I don't know what! <script language="javascript"><!-- var i=0; function resize() { if (navigator.appName == 'Netscape') i=10; if (document.images[0]) { imgHeight = document.images[0].height+100-i; imgWidth = document.images[0].width+60; var height = screen.height; var width = screen.width; var leftpos = width / 2 - imgWidth / 2; var toppos = height / 2 - imgHeight / 2; window.moveTo(leftpos, toppos); window.resizeTo(imgWidth, imgHeight); } self.focus(); } //--></script> Any help would be very much appreciated :thumbsup:
michaelrose62 Posted March 21, 2008 Posted March 21, 2008 Everyone is so great with offering help I was wondering if someone could also help me with this problem please? I would like the image in my pop-up window to be in the center of the window instead of in the left hand side of the window. I have looked at catalog/popup_image.php and I think that something needs to be changed to achieve that but I don't know what! <script language="javascript"><!-- var i=0; function resize() { if (navigator.appName == 'Netscape') i=10; if (document.images[0]) { imgHeight = document.images[0].height+100-i; imgWidth = document.images[0].width+60; var height = screen.height; var width = screen.width; var leftpos = width / 2 - imgWidth / 2; var toppos = height / 2 - imgHeight / 2; window.moveTo(leftpos, toppos); window.resizeTo(imgWidth, imgHeight); } self.focus(); } //--></script> Any help would be very much appreciated :thumbsup: Hello, Im new here too but I must say my popup_image.php code is different then yours. In your code it looks obvious to me how to make the change your trying to make. I believe in this line: window.moveTo(leftpos, toppos); Change it to this: window.moveTo(centerpos, toppos); I am looking at this again and I think you want to center your image in your popup window right? If so then I think you want to change this line: var leftpos = width / 2 - imgWidth / 2; To this: var centertpos = width / 2 - imgWidth / 2; Unfortunately I dont have the same code as you so I cant test it. I would try making that change and remember where you made the change and test it. If something goes haywire, just change it back. Its always good to make backups of your code before you make changes, copy an entire file, paste into notepad or text editor and save it then make your changes, You can always come back to it later. Good Luck, Michael
Guest Posted April 16, 2008 Posted April 16, 2008 Hi Michael, Thanks for that however neither suggestions seem to work. If I change either of the leftpos to centerpos or both of them then what it does is open the window but not the right size so you can't see all of the image, but what I can see of the image is still in the top left hand corner of the box. Any other suggestions would be much appreciated. Thanks for trying. :thumbsup:
Recommended Posts
Archived
This topic is now archived and is closed to further replies.