user3473709
user3473709

Reputation: 1

Popup positioning in CSS/javascript

I am not a programmer in any way, but I was able to figure out how to use an online tool to create the pop up image map I wanted, and I figured out which parts of the code (which appears to be a combination of javascript and css, I think, our site is mostly css) controlled some of the elements I wanted to change (background color and size/shape of the popup boxes). My last problem, which I have been unable to solve, is fixing the positioning. Three of the popups fall off the page and cannot be fully viewed/read. Currently, they pop up to the lower right of the cursor when it hovers over the image. If I can switch this to the left side, I should be fine.

Here is the site, to provide an idea of what I am talking about: http://www.foresightdesign.org/education/flsi/transect.php

Im happy to paste in the code, if needed.

Upvotes: 0

Views: 124

Answers (1)

fzzylogic
fzzylogic

Reputation: 2283

To move it to the left top, change the javascript to this:

tt.style.top = (y - 320) + 'px';
tt.style.left = (x - 420) + 'px';

This will work as long as your div's remain statically sized to 300x400px. If it's too far left increment the x value (maybe - 210 would be better as that would center it above the cursor.)

Upvotes: 1

Related Questions