The speech bubble tips plugin allows you to add nifty callout pointers to your tooltips. A wide range of options are available to style the tips, including height and width, colour and orientation/position on the tooltip. They even adjust with your tooltip when viewport adjustment is enabled!

Elements

When the tip plugin is in use on a tooltip, a new element becomes available within the API elements object, which references the newly created tip:

$('.selector').qtip({ content: { text: 'Tips plugin element' }, events: { render: function(event, api) { // Grab the tip element var elem = api.elements.tip; } } })

Styling

Styling the tip's background and border colours is done via CSS, not the options below. These are detected from the styles set on the qtip-tip element listed above. If no valid style can be found for the background or border colour properties, qTip will look for styles on specific elements, depending on what it's looking for:

border-color

  • qtip-tip element
  • qtip-titlebar element - If present and tip overlaps
  • qtip-content element

background-color

  • qtip-tip element
  • qtip-titlebar element - If present and tip overlaps
  • qtip-content element
  • qtip element

If no valid style can be found on any of these elements, the initially detected style of the qtip-tip element will be used. A notable exception to the inheritance is the border property, which can be used to override the detected CSS border-width.

#000000 = Invalid style!

Since, by default, most browsers default to using pure black (rgb(0,0,0), #000 etc.) as the default colour, if qTip2  detects this it will look elsewhere for the styles as listed above. If you need to use pure black, the best work around is to use something very close to it visually, such as rgb(0,0,1) or #000001.

style.tip.corner

Values

true, "Corner", false (Default: true)

Overview

Defines where in relation to the tooltip the speech bubble tip is applied. Check-out the positioning docs for a full set of corner strings.

Examples

Let's create a regular qTip with a tip whose corner is inherited from the position.my option:

$('.selector').qtip({ content: { text: 'I have a nice little callout pointer... nifty huh?' }, style: { tip: { corner: true } } });

We can also manually specify a different corner like so (if viewport adjustment is enabled, the tip position will not be adjusted):

$('.selector').qtip({ content: { text: 'I have a nice little callout pointer... nifty huh?' }, style: { tip: { corner: 'left center' } } });

See also

Notes

  • When set to true, the tip position will be inherited from the position.my property and adjusted automatically if viewport adjustment is enabled.
  • The positioning values of 'center' and 'center center' are not valid positioning values in this plugin.

style.tip.mimic

Values

"Corner", false (Default: false)

Overview

Used in conjunction with style.tip.corner, this option overrides what corner type is rendered. Specifying a corner string here will cause the tip to render as this corner type, regardless of its position in relation to the tooltip.

You can also specify a single corner property e.g. "left" or "center", which will cause the tip to inherit its other properties from the corner string. This is primarily useful when using mimic with the position.viewport functionality.

Examples

Let's create a qTip with a similar tip style to ClueTip, whose tip arrow is equilateral and placed toward the top of the tooltip.

$('.selector').qtip({ content: { text: 'I look very similar to a ClueTip tooltip in terms of my callout pointer.' }, style: { tip: { corner: 'right top', mimic: 'right center' } } });

As mentioned above, we can also use mimic with a single value too, to make for example the tip mimic 'center' and comply with viewport adjustment changes:

$('.selector').qtip({ content: { text: 'My tip will mimic the center style regardless of position or viewport adjustment!' }, position: { viewport: $(window) // Adjust position to keep within the window }, style: { tip: { corner: 'right top', mimic: 'center' // Single 'center' value here } } });

See also

Notes

  • This option overrides the presentation of the tip only. It does not effect the tips position!

style.tip.border

Values

true, Integer (Default: true)

Overview

This option determines the width of the border that surrounds the tip element, much like the CSS border-width property of regular elements. If a boolean true is passed, the border width will be detected automatically based on the border-width of the side the tip falls on. See the styling section for more information on this.

Examples

Let's create a qTip with a style to Google Maps tooltips, whose arrow blends with the border of the tooltip:

$('.selector').qtip({ content: { text: 'I look very similar to a Google Maps tooltip!' }, style: { classes: 'qtip-light', tip: { corner: 'bottom center', mimic: 'bottom left', border: 1, width: 88, height: 66 } } });

Notes

  • Unlike qTip1 the tip border follows the normal CSS property and applies the border outside the element, not inside.
  • See the styling section for more information on border-width detection

style.tip.width

Values

Integer (Default: 6)

Overview

Determines the width of the rendered tip in pixels, in relation to the side of the tooltip it lies upon i.e. when the tip position is on the left or right, this quantity actually refers to the tips height in visual terms, and vice versa.

Examples

Let's make a tooltip with an elongated tip width

$('.selector').qtip({ content: { text: 'My callout pointer looks a bit wackier than usual' }, style: { tip: { corner: true, width: 24 } } });

See also

Notes

style.tip.height

Values

Integer (Default: 6)

Overview

Determines the height of the rendered tip in pixels, in relation to the side of the tooltip it lies upon i.e. when the tip position is on the left or right, this quantity actually refers to the tips width in visual terms, and vice versa.

Examples

Let's make a tooltip with an elongated tip height

$('.selector').qtip({ content: { text: 'My callout pointer looks a bit wackier than usual' }, style: { tip: { corner: true, height: 24 } } });

See also

Notes

  • Make sure this is a number only, don't include any units e.g. 'px'!
  • Prior to the 26th April 2012 nightly, this was an absolute value i.e. it determined the height of the tooltipin relation to the window. This was changed and you should update your code if you relied on this fact.

style.tip.offset

Values

Integer (Default: 0)

Overview

Determines the offset of the tip in relation to its current corner position.

Examples

Say your tooltip is positioned at the bottom left of your target, but you want the tip shifted slightly to left instead of flush with the side of the tooltip:

$('.selector').qtip({ content: { text: 'My callout pointer looks a bit wackier than usual' }, style: { tip: { corner: true, offset: 5 // Give it 5px offset from the side of the tooltip } } });

See also

Notes

  • This value is relative i.e. depending on which corner the tooltip is set it will behave differently.
  • If your value is too large positioning problems can occur. Don't exceed a value equal to the height/width of the tooltip if possible.
  • Negative values will only be applied to 'center' positioned tooltips e.g. top center, left center.

The modal plugin allows you to create tooltips which 'dim' the rest of the page when shown, drawing users attention. This is quite useful as a simple replacement for plugins such as ThickBox and jQuery UI Dialog

Elements

When the modal plugin is in use on a tooltip, a new element becomes available within the API elements object, which references the overlay element used to dim the page:

$('.selector').qtip({ content: { text: 'Modal plugin element' }, events: { render: function(event, api) { // Grab the overlay element var elem = api.elements.overlay; } } })

z-index property

When a qTip utilises the modal plugin (by setting show.modal.on to true) a separate z-index is applied from that of normal, non-modal qTips to prevent overlapping issues. The default z-index of modal qTips is simply 200 less than that of regular non-modals:

$.fn.qtip.zindex = 15000; // Non-modal z-index $.fn.qtip.modal_zindex = 14800; // Modal-specific z-index

When overriding the normal z-index property, be sure to change the modal-specific one too, but keep in mind you'll need to set it to a value lower than the non-modal property! Otherwise you'll run into funny problems with overlapping when using several different tooltips.

CSS

To dim the page, the modal plugin uses fullscreen div element. You can modify the colour and other attributes of the overlay in your jquery.qtip.css CSS file. Here's the default settings for the 'overlay' element:

#qtip-overlay{ position: fixed; left: -10000em; top: -10000em; } / Applied to modals with show.modal.blur set to true / #qtip-overlay.blurs{ cursor: pointer; } / Change opacity of overlay here / #qtip-overlay div{ position: absolute; left: 0; top: 0; width: 100%; height: 100%; background-color: black; opacity: 0.7; filter:alpha(opacity=70); -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; }

If this isn't already present in your CSS file you'll need to add it manually.

Note: If you need to adjust the opacity of the overlay, change the inner div's properties, not the #qtip-overlay element.

$.fn.qtip.modal_zindex

Value

14800

Overview

Determines the base z-index of all modal qTips on the page of which no modal qTip z-index will drop below.

Examples

If you're using another plugin that happens to use a higher z-index than the default, increase it a little:

// Now your qTip's appear above the other plugin elements, yipeee! $.fn.qtip.modal_zindex = 20000;

See also

Notes

  • Try to make sure this value stays below that of the $.fn.qtip.zindex property to prevent rendering issues.
  • Updating this option after you've already created some tooltips can have some pretty weird after-effects!

$.fn.qtip.plugins.modal.focusable

Value

['a[href]', 'area[href]', 'input', 'select', 'textarea', 'button', 'iframe', 'object', 'embed', '[tabindex]', '[contenteditable]']

Overview

An array of selectors used to determine which elements are considered "focusable" within the tooltip, for use with the stealfocus option.

See also

show.modal.on

Values

true, false (Default: false)

Overview

Determines whether or not the tooltip is 'modal' e.g. dims the rest of the page when shown.

Examples

Let's make a really quick login form that dims the rest of our page and is centered on screen

$('.selector').qtip({ content: { text: $('#LoginForm') }, position: { my: 'center', at: 'center', target: $(document.body) }, show: { modal: { on: true } } });

We can also use some shorthand notation instead:

$('.selector').qtip({ content: { text: $('#LoginForm') }, position: { my: 'center', at: 'center', target: $(document.body) }, show: { modal: true // Omit the object and set it to true as short-hand } });

See also

Notes

  • To dim the page a fullscreen translucent div is used, so all controls with a z-index lower than that of the blanket, as defined in your CSS file, will appear below and will be un-interactable whilst the blanket is visible.

show.modal.blur

Values

true, false (Default: true)

Overview

Determines whether or not clicking on the dimmed background of the page hides the tooltip and removes the dim. When enabled the overlay element has a 'blurs' class applied to it.

Examples

Let's modify our login tooltip so you can only hide the tooltip by clicking the title button or hitting escape:

$('.selector').qtip({ content: { text: $('#LoginForm'), text: 'Login', button: true }, position: { my: 'center', at: 'center', target: $(document.body) }, show: { modal: { on: true, blur: false } } });

See also

Notes

  • When enabled the overlay element has a 'blurs' class applied to it. See CSS section for more details.
  • To dim the page a fullscreen translucent div is used, so all controls with a z-index lower than that of the blanket, as defined in your CSS file, will appear below and will be un-interactable whilst the blanket is visible.

show.modal.escape

Values

true, false (Default: true)

Overview

Determines whether or not hitting the escape key will hide the tooltip.

Examples

Let's modify our login tooltip so you can only hide it by clicking the title button:

$('.selector').qtip({ content: { text: $('#LoginForm'), text: 'Login', button: true }, position: { my: 'center', at: 'center', target: $(document.body) }, show: { modal: { on: true, blur: false, escape: false } } });

See also

Notes

  • You must have the window focused for the keyboard event to be detected properly

show.modal.stealfocus

Values

true, false (Default: true)

Overview

Determines whether or not users can focus inputs and elements outside of the tooltip when visible. Elements that gain focus outside the tooltip when this is enabled will be immediately blured and focus restored to the first focusable element within the tooltip.

Elements within the tooltip that are considered "focusable" are determined by the array of selectors in the $.fn.qtip.modal.focusable property.

See also

show.modal.effect

Values

function() {}, true, false (Default: true)

Overview

Determines the type of effect that takes place when showing and hiding the modal overlay. A custom method can also be used whose scope is the overlay element when called. If set to false, no animation takes place. If set to true, a default a fadeIn animation takes place with a duration of 90ms.

Examples

Let's create a modal tooltip whos overlay fades in to a custom opacity

$('.selector').qtip({ content: { text: 'I\'m a model tooltip with a custom overlay opacity' }, show: { modal { on: true, effect: function(state) { / "state" determines if its hiding/showing "this" refers to the overlay 0.4 and 0 are the show and hide opacities respectively. / $(this).fadeTo(90, state ? 0.4 : 0, function() { if(!state) { $(this).hide(); } }); } } } });

Notes

  • By default a fadeIn animation takes place with a duration of 90ms.


Related news

East coast durban accommodation lodge
Metang wildlife centre accommodation cape
Runescape vampire slayer quest
Accommodation de rust south africa
Holiday accommodation pialba map
Fairway wood swing sequence seve
Parque shopping guarulhos airport
Creation monetaire par les banques au
Enrhumer que faire ce