javascript - Tooltipster maxWidth setting - Stack Overflow

Could someone please help me. I'm looking for a solution for setting a maxwidth on a Tooltipster t

Could someone please help me. I'm looking for a solution for setting a maxwidth on a Tooltipster tooltip bubble. I'm not talking about the area which activates the tooltip, I'm talking about the tooltip bubble itself. When I put a few sentences of text in a tooltip it stretches from the left to the right of my screen and sometimes goes off the page. I want to be able to set a max width at say 400px, where anything in excess would be broken onto a new line.

tooltipster-maxwidth

I already checked and tried changing this in the javascript file:

maxWidth Set a maximum width for the tooltip. Default: null (no max width)

But nothing happened. It still appears like it does in the screenshot. Could it be because I've applied it to a paragraph tag? I tried to apply it to a span tag instead but it did the same thing.

Could someone please help me. I'm looking for a solution for setting a maxwidth on a Tooltipster tooltip bubble. I'm not talking about the area which activates the tooltip, I'm talking about the tooltip bubble itself. When I put a few sentences of text in a tooltip it stretches from the left to the right of my screen and sometimes goes off the page. I want to be able to set a max width at say 400px, where anything in excess would be broken onto a new line.

tooltipster-maxwidth

I already checked and tried changing this in the javascript file:

maxWidth Set a maximum width for the tooltip. Default: null (no max width)

But nothing happened. It still appears like it does in the screenshot. Could it be because I've applied it to a paragraph tag? I tried to apply it to a span tag instead but it did the same thing.

Share Improve this question edited Sep 11, 2014 at 11:52 neelsg 4,8425 gold badges37 silver badges58 bronze badges asked Sep 11, 2014 at 11:41 JonnyJonny 311 silver badge2 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

The maxWidth option that's given with Tooltipster is one that needs to be passed into the tooltipster() function when you initialise the tooltip itself, i.e.

$('.tooltip').tooltipster({
    // Other setup goes in here as key:value pairs
    'maxWidth': 500   
});

From the example above, this will "restrict" your tooltips to occupy a max width of 500 pixels. I've setup a very simple JSFiddle showing various examples with custom maxWidth options which should help you out with the syntax.

I hope this helps :)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744104949a4558683.html

相关推荐

  • javascript - Tooltipster maxWidth setting - Stack Overflow

    Could someone please help me. I'm looking for a solution for setting a maxwidth on a Tooltipster t

    8天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信