views:

1009

answers:

3

Hello,

I'm trying to resize an image map on window resize event. The closest I've gotten is to use a mouseclick event, but it needs to be window resize for what I'm doing. I'm using Firefox 3.5.5

I'm using jquery somewhat. Here's my example - the area button I want to resize on window resize is in the top left (click on it to resize map and area button):

http://www.whitebrickstudios.com/foghornstour/imagemap3.html

Any help would be appreciated! Thank you, Rich

A: 

To call a function when the window is resized, try the following:

$(window).bind('resize', function() {
    // resize the button here
});

Also, line 37 is missing a dollar sign:

scaleXY('theMap',(window).width());

It should be:

scaleXY('theMap',$(window).width());
Jordan Ryan Moore
Although you speak truth, the OP is already doing this if you bothered to read the code.
Crescent Fresh
So it works, but, I have to resize firefox 6 times in order for it to work. IE is a mess.I made those changes. This is helpful, but, it's looking like Firefox and especially IE are having too much trouble resizing.I'm thinking now that I'm going to stick with my original plan and just use semi-accurately positioned divs to take the place of image map buttons.Damn. I'll be thinking about this though and if I ever come up with and answer I'll post it.Thanks for your help guys.
Inserter
here's the link:http://www.whitebrickstudios.com/foghornstour/imagemap3.html
Inserter
I had already "bothered" to read the code; however, the question itself didn't make it clear that this part of the solution wasn't the problem. I added the basic resize event handling for those who might find this later when searching for a solution. The second half of my question did address one of the problems with the code, so I'm unsure why I should receive a downvote.
Jordan Ryan Moore
A: 

If you only need to resize the image, use this technique: http://www.cssplay.co.uk/layouts/background.html

Thanks to CSSPlay.

danigb
I think you're missing the point danigb. I'm looking to resize an 'image map area', on window resize.
Inserter
Now I understand. In fact, i've opened your url and it didnt work for me (chrome).I had to do something similar and I ended using divs instead of imagemaps and setting the position: absolute; and top, left, width and height in % units.If you what i can explain a little bit more.cheersdani
danigb
Hey Danigb, I ended up using divs as well to position images with %s.Though it'd still be cool to use image maps in a future version. This is what I have for image maps so far.http://home.comcast.net/~urbanjost/IMG/resizeimg4.html
Inserter
woops, meant to use this link:http://www.whitebrickstudios.com/foghornstour/imagemap3.html
Inserter
A: 

I think what you want is at http://home.comcast.net/~urbanjost/semaphore.html

where I show different examples of how to make your image map coordinates change when your image display size changes.

urbanjost
I actually incorporated some of the code in those examples. The problem I ran into though, was that though the image map would resize for events like 'click', it would not adjust on 'window resize' event.--Well it does, you just have to resize the browser 6 times to get it to work. I'm using FF 3.5Sorry my link went broke, it's fixed now:http://www.whitebrickstudios.com/foghornstour/imagemap3.htmlI've opted to use divs positioned by %s but it'd be really cool to get this working one day.
Inserter