Select to view content in your preferred language

Overview Map On Hide/Show events

1126
5
Jump to solution
04-23-2013 06:54 AM
AdrianMarsden
Honored Contributor
Hi

Am I missing something, but according to the API notes there appears to be no events for the overview map.  What i am wanting to do is when a user hides the overview map, a cookie/local storage thingy is written with the map status.  This will then get read in next time they use the page.  But I can't seem to find any events to hang the code from

Cheers

ACM
0 Kudos
1 Solution

Accepted Solutions
OrenGal
Regular Contributor
try this:

dojo.connect(overviewMap, "onClick", overviewMapClick);

function overviewMapClick() {
    localStorage.overviewMap = (overviewMap.visible ? "max" : "min");
}



after creating the overview (next time) check:
if (localStorage.overviewMap == "min")
        overviewMap.hide();

View solution in original post

0 Kudos
5 Replies
SteveCole
Honored Contributor
I don't have any experience with the OverviewMap so this is all just a wild guess/suggestion but how about adding a listener to the overview map based on a CSS styling change? Presumably, the CSS is just changed to "display:hidden" when it's minimized. I don't know how you would craft a dojo.connect for a CSS styling change but this link has some hints about event handlers for CSS changes in general.

Steve
0 Kudos
OrenGal
Regular Contributor
try this:

dojo.connect(overviewMap, "onClick", overviewMapClick);

function overviewMapClick() {
    localStorage.overviewMap = (overviewMap.visible ? "max" : "min");
}



after creating the overview (next time) check:
if (localStorage.overviewMap == "min")
        overviewMap.hide();
0 Kudos
AdrianMarsden
Honored Contributor
Thanks, but alas, that fires off every time you click onto the overview map in order to navigate using it.

Does the Hide button have its own events I wonder?

ACM
0 Kudos
OrenGal
Regular Contributor
I know. Well, this is what I use until the JS team will add functionality.
I am not worried about the unnecessary firing. The client will handle it...
Oren
0 Kudos
AdrianMarsden
Honored Contributor
I know. Well, this is what I use until the JS team will add functionality.
I am not worried about the unnecessary firing. The client will handle it...
Oren


Ah, sorry, didn't look close enough at what you were doing, clever that (what you are doing, not me not looking)

Working on it now, many thanks

ACM
0 Kudos