Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Looks like this is the best I could wrangle up.</p> <p>Hopefully it helps you a bit Fvant?</p> <pre><code>/* * Hide our tooltip DIV until a * point has been hovered over * on the map */ $("#tooltip").hide(); /* * Creates a marker for the given business and point */ function createMarker(biz, point, markerNum, category) { var infoWindowHtml = generateInfoWindowHtml(biz) var marker = new GMarker(point, yicon); marker.mycategory = category; yelpMarkers.push(marker); ymap.addOverlay(marker); GEvent.addListener(marker,'mouseover',function(){ showMessage(this, infoWindowHtml); }); GEvent.addListener(marker,'mouseout',function(){ $("#tooltip").hide(); }); </code></pre> <p>}</p> <pre><code>/* * Displays a Tooltip for the currently hovered marker */ function showMessage (marker, text) { var markerOffset = ymap.fromLatLngToContainerPixel(marker.getPoint()); var winWidth = $(window).width(); var winHeight = $(window).height(); var theight = 20; //The twidth number below is half of our tooltip width. var twidth = 175; /* * The twidth2 number below is the width of the main content * container area. Assumes a default window width of 1265 */ var twidth2 = 397; var extraPad; var tLeft; var tTop; // Setup our tooltip's width offset for different window widths if (winWidth &gt; 1265) { extraPad = winWidth - 1265; tLeft = markerOffset.x + twidth2 + (extraPad/2); } else if (winWidth &lt; 1265) { extraPad = 1265 - winWidth; tLeft = markerOffset.x + twidth2 - (extraPad/2); } else { tLeft = markerOffset.x + twidth2; } // Setup our tooltip's height offset for different window height tTop = markerOffset.y - theight; $("#tooltip") .fadeIn() .html("&lt;div class='content'&gt;"+text+"&lt;/div&gt;") .css({ top: tTop, left: tLeft }) .appendTo("body"); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload