CSS & amp; Bootstrap: simple application of tooltips, css tutorial

Source: Internet
Author: User

CSS & Bootstrap: simple application of tooltips, css tutorial
1.
For a common Element, first add an atip class in the class and add the corresponding value.
Data-toggle unchangeable data-placement can be set to top | bottom | left | right | auto. title is not empty, the title is displayed; otherwise, the data-original-title is displayed.


2. Of course, the most basic files must be imported.
Then write a JS script.
Trigger: How tooltip is triggered-click | hover | focus | manual. For other attributes, refer to the corresponding API

Name Type Default Description
Animation Boolean True Apply a CSS fade transition to the tooltip
Container String | false False

Appends the tooltip to a specific element. Example:container: 'body'. This option is special useful in that it allows you to position the tooltip in the flow of the document near the triggering element-which will prevent the tooltip from floating away from the triggering element during a window resize.

Delay Number | object 0

Delay showing and hiding the tooltip (MS)-does not apply to manual trigger type

If a number is supplied, delay is applied to both hide/show

Object structure is:delay: { "show": 500, "hide": 100 }

Html Boolean False Insert HTML into the tooltip. If false, jQuery'stextMethod will be used to insert content into the DOM. Use text if you're worried about XSS attacks.
Placement String | function 'Top'

How to position the tooltip-top | bottom | left | right | auto.
When "auto" is specified, it will dynamically reorient the tooltip. for example, if placement is "auto left", the tooltip will display to the left when possible, otherwise it will display right.

When a function is used to determine the placement, it is called with the tooltip DOM node as its first argument and the triggering element DOM node as its second.thisContext is set to the tooltip instance.

Selector String False If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have tooltips added. Seethisandan informative example.
Template String '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'

Base HTML to use when creating the tooltip.

The tooltip'stitleWill be injected into.tooltip-inner.

.tooltip-arrowWill become the tooltip's arrow.

The outermost wrapper element shoshould have.tooltipClass.

Title String | function ''

Default title value iftitleAttribute isn't present.

If a function is given, it will be called with itsthisReference set to the element that the tooltip is attached.

Trigger String 'Hover focal s' How tooltip is triggered-click | hover | focus | manual. You may pass multiple triggers; separate them with a space.
Viewport String | object {Selector: 'body', padding: 0}

Keeps the tooltip within the bounds of this element. Example:viewport: '#viewport'Or{ "selector": "#viewport", "padding": 0 }


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.