I embed CartoDB visualizations on a variety of websites with different column widths, and on the narrower ones infowindows can be annoying.
The normal behavior on click is for the map to pan to where the infowindow is fully visible above and right of the marker. But if you have a lot of data and you want people to be able to compare multiple markers or polygons, users start getting bounced all over the place.
What I'd like to achieve is something like this Google maps example:
If you click on one of the markers, pretending it's the tip of a clock hand and dragging it clockwise around the frame, you'll see what they're calling a "smart infowindow" -- it repositions itself toward the center of the frame.
But I'm not as interested in the repositioning capability (although that's awesome, it seems like overkill) as I am in it initially detecting which direction to open. If the marker is on the right side, the infowindow pops open to the left. If it's on the left side, it pops to the right.
How can I do that with a CartoDB map?