V Phelps

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromV Phelps
ToMe
SubjectOffsetting a Centered Perfect Popup Window
Date25 March 2006 02:11
Dear Mark,

After two weeks of struggling, the right Google search finally landed me on
your excellent Perfect Popups page. I must say that after a day of
tinkering, your script looks much more promising than anything else I've
tried so far.  I am a javascript novice but if I can get my hands on a
working example, most of the time I can eventually figure out how to apply
the code to my own content.

In this case, the one piece I'm missing is figuring out how to offset the
Perfect Popup to the right of center.

I have read through your emails and searched your site but do not find
anything that addresses offsetting the centered popup window.  That's not to
say the answer isn't there somewhere already; I just couldn't find it or
didn't recognize it for what it was.  I would very much appreciate it if you
could direct me to specific information that will help me address this
issue.

For the web site I am working on (see [URL]) the vertical centering in the
code is OK as is. But I would like to offset the popup window horizontally
by about 130px to the right so that it doesn't end up obscuring the
thumbnails that are being used to pop open the window.

Also, from my mockup page you'll notice my intention to add switching
controls into the popup window.  If you have any words of wisdom or can
point me to where this might already have been discussed, I would be
grateful for any direction or assistance in that area too!

I sincerely appreciate all the time and generosity with your expertise that
you have given so freely!

V Phelps
*Only the first three rows of thumbnails have the appropriate code applied
to them; the first row shows the internal controls that I would ideally like
to add, and the other six just contain text below the image.
FromMe
ToV Phelps
SubjectRe: Offsetting a Centered Perfect Popup Window
Date26 March 2006 07:47
> I would like to offset the popup window horizontally by about 130px to
> the right

Change this line:
'if( !window.opera ) {
 x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
to this:
'if( !window.opera ) {
 x.moveTo(Math.round((scW-oW)/2)+130,Math.round((scH-oH)/2)); }\n'+

> Also, from my mockup page you'll notice my intention to add switching
> controls into the popup window.

I have never done this, and not really sure how it could work. I tried
working through the opening window's link onclick handler, but that
triggers popup blockers. Afraid I can't think of a nice way to do it.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromV Phelps
ToMe
SubjectRe: Offsetting a Centered Perfect Popup Window
Date26 March 2006 19:05
Thank you Mark!  I can't believe how simple that fix was!  I had been
thinking it was necessary to add another set of parens around the "+130". 
I've got so much to learn about javascript.

As for the popup controls, I got the idea from the [business] Art
Gallery web site: [URL] ...but
I haven't been successful in marrying their code methodology with yours.  On
the Yale site, clicking outside of the popup doesn't close it, which is a
huge plus of your method.  Also, having controls within their popup is more
important since it lands in a different screen position in each browser. 
With your code, the only browser I've tested so far that isn't dead center
is Opera 7.54.  And the way my site is laid out, it's high enough on the
screen that it's possible to still access the thumbnail anchors.

Speaking of testing, I don't yet have Opera 8 but I gather that is what you
use.  I would like to have both versions of Opera but I'm afraid to download
8 because I don't want it overriding the older version.  Would you happen to
know whether it's possible to load the two side by side on the same
computer? (do you have them both?)

Again, my sincere thanks to you for so freely helping all of us to better
understand and successfully use javascript, and especially for your elegant
and robust solutions.  I'm looking forward to exploring all the other pages
on your site when I'm done with this project.  And of course when I get my
popups perfected I will include a link to your site!

V
FromMe
ToV Phelps
SubjectRe: Offsetting a Centered Perfect Popup Window
Date27 March 2006 09:48
> With your code, the only browser I've tested so far that isn't dead center
> is Opera 7.54.

Yep. Opera's MDI makes it impossible for me to centre it because the centre
is the centre of the workspace, but I can only get the information about the
screen. Without being able to tell how big the workspace is (or even if the
user has MDI enabled), I risk positioning it out of sight if I try to centre
it. It does not look so good as the others, but at least you can see it ;)

> Speaking of testing, I don't yet have Opera 8 but I gather that is what
> you use.  I would like to have both versions of Opera but I'm afraid to
> download 8 because I don't want it overriding the older version.  Would you
> happen to know whether it's possible to load the two side by side on the
> same computer? (do you have them both?)

I use Opera 9 (currently technical preview 2, but that changes with each
development release). You can install as many copies as you want on the same
computer - I currently have about 100 on this computer alone, just make sure
you install them into different directories (usually, I will say that I do
not want separate profiles for each computer user - so the profile is stored
in the same folder as the program), but the way they behave is different on
different operating systems.

On Mac, all installs share most of their profile with each other, so changes
you make in one also affect the others.
On Linux/UNIX, all installs share profiles by default, but you can use the
-personaldir switch to make them use different profiles.
On Windows, installs always use separate profiles if you install them in
different folders.

So in other words, if you use Windows, it is easy; just install them in
different folders, and they will happily run without affecting each other.

If you want to grab the Opera 9 versions, you can get them from the snapshot
server http://snapshot.opera.com/ - the JavaScript and CSS have significant
improvements over Opera 8. I no longer use the 7.x series at all (except for
occasional testing), as it has been far surpassed by Opera 8.
FromV Phelps
ToMe
SubjectRe: Offsetting a Centered Perfect Popup Window
Date27 March 2006 19:20
Thank you for the information both on the reasons for Opera's non-centering
and on loading various versions of Opera.  I'm impressed that you have 100
copies of Opera on one computer although I'm having a hard time fathoming
why. ;-)  My reasons for wanting old as well as new versions is for testing
web pages.  It's useful to know that what I would normally consider an
inefficiency of Windows actually makes installing multiple browser versions
easy.

Again, my sincere thanks and appreciation for being so generous with your
time and expertise!  I look forward to 'discovering' all the new things you
add to your site.

V
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.