|
#1
|
|||
|
|||
|
1) Script Title:
Rich HTML Balloon Tooltip 2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...oontooltip.htm 3) Describe problem: I implemeted the script on my site, using the code given on dynamicdrive. The problem is, the text on my site will be dynamically shown based on what my users have submitted, and if a user has submitted a really wrong URL, part of it will not be visible since the text will be too long to fit in the balloon. Is there a way to modify the balloon so that the text continues to a next line if the text that is supposed to be shown has no spaces and is really long (like long URLs)? Thanks, n. |
|
#2
|
||||
|
||||
|
Only IE officially has a style that explicitly sets the wrapping of content to allow breaking words. So, at least for that browser (Safari 3 Win also respects this style), you could set:
Code:
.balloonstyle, .balloonstyle * {
word-wrap: break-word;
}
Another choice would be to validate the length of the URL segments, and either not allowing: Quote:
If you put <wbr></wbr> tags around each character, it will allow it to wrap on any character in FF, Safari 3 Win, and IE, but not Opera: HTML Code:
<wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr><wbr>g</wbr> One style that just about all browsers would respect is overflow. You could set the overflow to hidden, this would crop the extra portion, make it invisible.
__________________
WWWWWWWWWWWW - John________________________ Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate |
|
#3
|
||||
|
||||
|
After typing the above, I decided to Google the <wbr> tag, and found a way of using it here (though it certainly isn't a valid tag any longer), that will work in virtually all modern browsers (except Safari, for which you can still use the:
Code:
.balloonstyle, .balloonstyle * {
word-wrap: break-word;
}
For all others (though IE will also follow the above rule), you set this in your stylesheet*: Code:
wbr:after { content: "\00200B"; }
Code:
var breakURL = URL.replace(/(.)/g, '<wbr>$1'); * See: http://gojomo.blogspot.com/2005/03/c...-break-in.html for more info on this method as far as the style part of it goes.
__________________
WWWWWWWWWWWW - John________________________ Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate |
|
#4
|
||||
|
||||
|
An even simpler solution appears to be to use only this added style:
Code:
wbr { display: inline-block; }
__________________
WWWWWWWWWWWW - John________________________ Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
|
|