1

I am trying to dynamically move a google map (v3) from one div to the other and the first time I move the map from div "x" to "y" the map jumps nicely, but when I try to move it back to "x", I get:

Uncaught Error: HIERARCHY_REQUEST_ERR: DOM Exception 3

I've tried using:

var mapNode1 = map.getDiv();
$("#miniMap").append(mapNode1);

to jump from largeMap to miniMap

and vice versa by using:

var mapNode2 = map.getDiv();
$("#largeMap").append(mapNode2);

I've also tried using:

$("#largeMap").appendTo("#miniMap");

and $("#miniMap").appendTo("#largeMap");

With both methods, I am getting: Uncaught Error: HIERARCHY_REQUEST_ERR: DOM Exception 3

Does anybody have any ideas?

Thank you!

Kentor
  • 657
  • 1
  • 10
  • 27
  • Are you using #largeMap as element for the Map-initialization? If yes this cannot work, because getDiv() in that case will return #largeMap, and you cannot append #largeMap to #largeMap(it's the same element) – Dr.Molle Mar 31 '12 at 09:18
  • ah yes, you're right. that's why it wasn't working :) – Kentor Mar 31 '12 at 17:28

2 Answers2

1

The most probable causes for the error you describe are listed in another post on stackoverflow. See the accepted answer there. Otherwise, I have to see more of your code (maybe the full source) to try to find the exact cause of the error.

Community
  • 1
  • 1
Jeroen
  • 839
  • 13
  • 20
1

Hrmm, turns out the following worked:

I put miniMap inside a miniMapWrapper div and largeMap inside largeMapWrapper and used:

var mapNode1 = map.getDiv();
$("#miniMap").append(mapNode1);

and

$("#largeMap").appendTo("#largeMapWrapper");

to go back

Kentor
  • 657
  • 1
  • 10
  • 27