Ask Question Forum:
Model Library:2025-02-08 Updated:A.I. model is online for auto reply question page
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by seopti
at 2024-04-05 05:31:46
Point:500 Replies:1 POST_ID:828907USER_ID:10
Topic:
JavaScript;;
I'm trying to add a pixeloffset to the google maps infowindow but the position of the infowindow will not change when clicked. I can't find out why.
This is the code I'm adding.
This is the code I'm adding.
This is the original code.
function iwHandle(infowindow, map, marker, style) { if (infoWindowDivID !== ""){ externalDiv = document.getElementById(infoWindowDivID);" externalDiv.innerHTML = infowindow.content;" } else { infowindow.open(map,marker);" lastInfoWindow = infowindow;" }} 1:2:3:4:5:6:7:8:9:10:
function createMarker(latlng, index, html, category, icon, src, title, iconURL) { var myHtml;" if ( icon === undefined ) { icon = category;" } if (category == "pin") { if (markerGroups["pin"]) { for (var i = 0;" i <" markerGroups["pin"].length;" i++) { markerGroups["pin"][i].setMap(null);" } markerGroups["pin"].length = 0;" } var image = new google.maps.MarkerImage(iconPath + category + ".png", new google.maps.Size(mainIconWidth, mainIconHeight), new google.maps.Point(0,0), new google.maps.Point(mainAnchorPointX, mainAnchorPointY));" var shadow = new google.maps.MarkerImage( iconPath + category + "-shadow.png", new google.maps.Size(mainIconWidth, mainIconHeight), new google.maps.Point(0,0), new google.maps.Point(mainAnchorPointX, mainAnchorPointY));" var marker = new google.maps.Marker({ position: latlng, map: map, shadow: '', icon: image });" markerGroups["pin"].push(marker);" var infowindow = new google.maps.InfoWindow({ content: html });" google.maps.event.addListener(marker, 'click', function() { //map.panTo(latlng);" controlToggle("hide");" google.maps.event.addListener(infowindow, 'closeclick', function() { controlToggle("show");" });" infowindow.open(map, marker);" });" 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:26:27:28:29:30:31:32:33:34:35:36:37:38:39:40:41:42:43:44:
Accepted Solution
Expert: duncanb7 replied at 2024-04-05 08:26:42
500 points EXCELLENT
What is console error showing on browser debugger tool you have ? On chrome browser,
click options->tools->developer tools->console.
Please clean up all javascript syntax error first.
probably you put the line of pixelOffset: new google.maps.Size(60, 0), without ","
as follows and try the following portion code change.
click options->tools->developer tools->console.
Please clean up all javascript syntax error first.
probably you put the line of pixelOffset: new google.maps.Size(60, 0), without ","
as follows and try the following portion code change.
var infowindow = new google.maps.InfoWindow({ content: html, pixelOffset: new google.maps.Size(60, 0) });var curmark; google.maps.event.addListener(marker, 'click', function() {infowindow.open(map,this); curmark = this;controlToggle("hide");});google.maps.event.addListener(infowindow,'closeclick',function(){curmark.setMap(null); //removes the markercontrolToggle("show");}); 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:
If "this" is not working, please try to replace"this" with "marker"
And take a look this link for those option and example if have time
https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple
Hope understant your question completely, if not , please pt it out
Duncan