Click to See Complete Forum and Search --> : how to align the photos in a new window


Supergirl
06-10-2003, 10:33 AM
hello,

I'm using a slideshow script with function window.open to enlarge the photos in a new window.
is there a property for window.open like align, or center or something?

this is the script I'm using:

var Bild = new Array(6);
Bild[0] = new Image(); Bild[0].src="images/fotos/1.jpg";
Bild[1] = new Image(); Bild[1].src="images/fotos/2.jpg";
Bild[2] = new Image(); Bild[2].src="images/fotos/3.jpg";
Bild[3] = new Image(); Bild[3].src="images/fotos/4.jpg";
Bild[4] = new Image(); Bild[4].src="images/fotos/5.jpg";
Bild[5] = new Image(); Bild[5].src="images/fotos/6.jpg";
Bild[6] = new Image(); Bild[6].src="images/fotos/7.jpg";
var zeige = 1;

function Blaettern(Richtung)
{
zeige = zeige + Richtung;
if(zeige > Bild.length - 1) zeige = 0;
else if(zeige < 0) zeige = Bild.length - 1;
document.suzuki.src = Bild[zeige].src;
PA.innerHTML = "Bild " + (zeige + 1) + " von " + Bild.length;
}

function show()
{
window.open( document.suzuki.src , 'Preview', 'toolbar=no,
location=no,
directories=no,
status=no,menubar=no,scrollbars=no,resizable=no,
copyhistory=no,
width=520,height=418,screenX=0,screenY=0');
}

thx for your help! :)

the page is already online, if I'm allowed to post the link let me know.

Khalid Ali
06-10-2003, 11:14 AM
Locate this function in your js code

function show()
{
window.open( document.suzuki.src , 'Preview', 'toolbar=no,location=no,directories=no,
status=no,menubar=no,scrollbars=no,resizable=no,co
pyhistory=no,
width=520,height=418,screenX=0,screenY=0');
}


and replace it with this one

function show(){
var Preview = window.open( document.suzuki.src , 'Preview',
'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=n o,width=520,height=418,screenX=0,screenY=0');
Preview.document.body.style.textAlign="center";
}

oh BTW I have not tested it.so keep a backup of your original code..just in case..:D

pyro
06-10-2003, 11:15 AM
Is this what you need? http://www.infinitypages.com/research/centeredpopup.htm

Supergirl
06-10-2003, 11:28 AM
Originally posted by Khalid Ali
Locate this function in your js code

function show()
{
window.open( document.suzuki.src , 'Preview', 'toolbar=no,location=no,directories=no,
status=no,menubar=no,scrollbars=no,resizable=no,co
pyhistory=no,
width=520,height=418,screenX=0,screenY=0');
}


and replace it with this one

function show(){
var Preview = window.open( document.suzuki.src , 'Preview',
'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=n o,width=520,height=418,screenX=0,screenY=0');
Preview.document.body.style.textAlign="center";
}

oh BTW I have not tested it.so keep a backup of your original code..just in case..:D

nope, not woking, thou sounds good. I'll check the other thread now. do u want the url to the site so you have a better look?

Supergirl
06-10-2003, 11:31 AM
Originally posted by pyro
Is this what you need? http://www.infinitypages.com/research/centeredpopup.htm

nope, this ist just a pop up in the middle of my screen. thx anyway.

I want my graphic to be centered in the new window. I have a kind of frame on the left and top now. if I make the window smaller, my picture gets cut on the right and bottom, but the frame on the left and top is still there.

pyro
06-10-2003, 11:39 AM
Oops... Missunderstood what you were looking for... :p

I think the problem is that you are opening a new window, but that window only contains the image, no html. This is more than likely why Khalid's suggestion did not work.

Try this (untested):

function show(){
var Preview = window.open('', 'Preview', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=n o,width=520,height=418,screenX=0,screenY=0');
Preview.document.write('<html><head><style type="text/css">body {text-align: center;}</style></head><body><img src="'+document.suzuki.src+'"></body></html>');
}Note: You will have to take out some of the breaks that the forums applied...

Supergirl
06-10-2003, 11:46 AM
this looks good too. I now have a html text inside my popup, though object is still not centered.
I have NO experience with css. do I have to make another
adjustments too?

pyro
06-10-2003, 12:09 PM
You could try changing this part of the code:

<style type="text/css">body {text-align: center;}</style>to:

<style type="text/css">img {margin: auto;}</style>

Supergirl
06-10-2003, 12:33 PM
Originally posted by pyro
You could try changing this part of the code:

<style type="text/css">body {text-align: center;}</style>to:

<style type="text/css">img {margin: auto;}</style>

no.... no...... no........

:mad: :mad: :mad:

just tried to put <center> between body & /body

nothing............. :mad:

pyro
06-10-2003, 12:41 PM
I made a typo above. I had Previe.document.write() should be Preview.document.write()... Try changing that...

Supergirl
06-10-2003, 01:06 PM
thank you so much, you are very patient. I allready tried it.
I'll try it once again.

pyro
06-10-2003, 01:08 PM
This worked for me...

Supergirl
06-10-2003, 01:11 PM
no, it's not working.

if not allowed please delete

w*w.streetbike.de

under "fahrzeuge" the suzuki ist the one I tried with scripts. take a look, maybe you see something else bothering your script so it doesn't work.

thx

Khalid Ali
06-10-2003, 01:17 PM
Hey how about giving this a try...

http://68.145.35.86/skills/javascripts/OpenImageSizedWindow2.html

Supergirl
06-10-2003, 01:19 PM
I tried supergirl.htm with test.gif and it's working.
why not with another page??

Supergirl
06-10-2003, 01:23 PM
Originally posted by Khalid Ali
Hey how about giving this a try...

http://68.145.35.86/skills/javascripts/OpenImageSizedWindow2.html

wow, that's the way it should be!
I'll try to build it in my page. I'll let you know. :)

Khalid Ali
06-10-2003, 01:26 PM
Originally posted by Supergirl
wow, that's the way it should be!
I'll try to build it in my page. I'll let you know. :)


You are welcome ..I guess..:cool:

Supergirl
06-10-2003, 02:44 PM
oh yes
THANK YOU BOTH SO MUCH !!!!!!!!!!!!!!!!!!!

I just put

<body class="body" style="margin-top:1px;margin-left:1px;">

instead of <body> here:

function show(){
var Preview = window.open('', 'Preview', 'toolbar=no,location=no,
directories=no,status=no,m
enubar=no,scrollbars=no,resizable=no,
copyhistory=n
o,width=520,height=418,screenX=0,screenY=0');
Preview.document.write('<html><head><style type="text/css">body {text-align: center;}
</style></head>

<body> <------------------------------------------

<img src="'+document.suzuki.src+'">
</body></html>');
}

IT IS WORKING !
thank you, thank you!
If u have questions about emule, let me know. you have the email adress!

:D :D :D :D :D :D :D :D :D