Jump to content

Centering a popup


MrAdam

Recommended Posts

Hi im trying to create a kind of pop up, much like the "My Assistant" menu on this forum. A can create the menu itself quite easily, just my problem is positioning it. I want to create it dead center horiztonally (not so bothered about vertically). I've tried using "screen.width", and then doing few sums to create a from left number, but it's not going well. Does anybody already have a script, or know the best way of doing it?-Thanks

Link to comment
Share on other sites

it's not? .. if my pop up was say 400px wide, and my res like 1024, it would be 824px from the left, definately not the middle. i would have thought it would be: '(screen.width - popupWidth) / 2' ??but i can't seem to get that to work...:: UPDATE ::

var promptWidth = 400;var fromLeft = ((screen.width - promptWidth) / 2) - 21;

.. done it

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...