How to add a line break to title

4,188 views
Skip to first unread message

atagaew

unread,
Mar 2, 2010, 9:26:47 AM3/2/10
to Google Maps JavaScript API v3
Hi guys.

I'm using google map API for generating some objects on the map.

When user is rolling the mouse pointer over the object, I'm showing
him the description of this object

To do that, I'm passing 'title' option with the description to the
google.maps.Marker object.

My question is how can i arrange that title in a few lines, so it will
look more attractive to the user ?

I tried to insert '\n' or '
' to the title text but no luck.

Is having few lines in the Marker's tooltip possible at all ?

atagaew

unread,
Mar 4, 2010, 6:09:20 PM3/4/10
to Google Maps JavaScript API v3
Guys,

Any ideas ?

Is it possible at all ?

Brak

unread,
Mar 5, 2010, 8:25:59 AM3/5/10
to Google Maps JavaScript API v3
The title that's automatically generated from hovering over a marker
is actually the standard HTML title attribute, which works the same
way as the alt tag attribute on an image. It's not exactly easy to get
multiple lines on one, since browsers decide for themselves when to
get the line to wrap (so really long alt texts and titles can be
readable, they wrap). I don't believe it's possible to forcibly insert
a line break.

However, this does not stop you from circumventing the generic title
text altogether and creating your own that's completely stylable. You
can attach an even to the marker for the 'mouseover' event and
generate a div tag filled with your content that follows the mouse
around; removing/destroying/hiding itself when the 'mouseout' event
fires. That seems like the most reliable way to me.

atagaew

unread,
Mar 7, 2010, 5:08:50 PM3/7/10
to Google Maps JavaScript API v3
It sounds great!
Thanks!

viraj...@os3infotech.com

unread,
Apr 19, 2017, 7:43:25 PM4/19/17
to Google Maps JavaScript API v3
Its fine with "TITLE Tags"... How about "LABEL".... how can one create multi-line label.

Thank you in advance.
Reply all
Reply to author
Forward
0 new messages