/    Sign up×
Community /Pin to ProfileBookmark

how to align the photos in a new window

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:

[code]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’);
}[/code]

thx for your help! ?

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

to post a comment
JavaScript

17 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliJun 10.2003 — 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=no,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..?
Copy linkTweet thisAlerts:
@SupergirlauthorJun 10.2003 — [i]Originally posted by Khalid Ali [/i]

[B]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=no,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..? [/B]
[/QUOTE]


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?
Copy linkTweet thisAlerts:
@SupergirlauthorJun 10.2003 — [i]Originally posted by pyro [/i]

[B]Is this what you need? http://www.infinitypages.com/research/centeredpopup.htm [/B][/QUOTE]


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.
Copy linkTweet thisAlerts:
@pyroJun 10.2003 — 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=no,width=520,height=418,screenX=0,screenY=0');
Preview.document.write('&lt;html&gt;&lt;head&gt;&lt;style type="text/css"&gt;body {text-align: center;}&lt;/style&gt;&lt;/head&gt;&lt;body&gt;&lt;img src="'+document.suzuki.src+'"&gt;&lt;/body&gt;&lt;/html&gt;');
}
Note: You will have to take out some of the breaks that the forums applied...
Copy linkTweet thisAlerts:
@SupergirlauthorJun 10.2003 — 
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?
Copy linkTweet thisAlerts:
@pyroJun 10.2003 — You could try changing this part of the code:

&lt;style type="text/css"&gt;body {text-align: center;}&lt;/style&gt;to:

&lt;style type="text/css"&gt;img {margin: auto;}&lt;/style&gt;
Copy linkTweet thisAlerts:
@SupergirlauthorJun 10.2003 — [i]Originally posted by pyro [/i]

[B]You could try changing this part of the code:



&lt;style type="text/css"&gt;body {text-align: center;}&lt;/style&gt;to:

&lt;style type="text/css"&gt;img {margin: auto;}&lt;/style&gt; [/B][/QUOTE]


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

:mad: :mad: :mad:

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

nothing............. :mad:
Copy linkTweet thisAlerts:
@pyroJun 10.2003 — I made a typo above. I had Previe.document.write() should be Previe[b]w[/b].document.write()... Try changing that...
Copy linkTweet thisAlerts:
@SupergirlauthorJun 10.2003 — thank you so much, you are very patient. I allready tried it.

I'll try it once again.
Copy linkTweet thisAlerts:
@pyroJun 10.2003 — This worked for me...

[upl-file uuid=de513e6c-dddf-4eef-80a8-734ae1948d1c size=697B]supergirl.txt[/upl-file]
Copy linkTweet thisAlerts:
@SupergirlauthorJun 10.2003 — 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
Copy linkTweet thisAlerts:
@SupergirlauthorJun 10.2003 — I tried supergirl.htm with test.gif and it's working.

why not with another page??
Copy linkTweet thisAlerts:
@SupergirlauthorJun 10.2003 — [i]Originally posted by Khalid Ali [/i]

[B]Hey how about giving this a try...



http://68.145.35.86/skills/javascripts/OpenImageSizedWindow2.html [/B]
[/QUOTE]


wow, that's the way it should be!

I'll try to build it in my page. I'll let you know. ?
Copy linkTweet thisAlerts:
@Khalid_AliJun 10.2003 — [i]Originally posted by Supergirl [/i]

[B]wow, that's the way it should be!

I'll try to build it in my page. I'll let you know. ? [/B]
[/QUOTE]



You are welcome ..I guess..?
Copy linkTweet thisAlerts:
@SupergirlauthorJun 10.2003 — 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!

? ? ? ? ? ? ? ? ?
×

Success!

Help @Supergirl spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...