Skip to content
This repository has been archived by the owner on Jun 14, 2020. It is now read-only.

Shorthand options

Craga89 edited this page Mar 18, 2013 · 5 revisions

Shorthand options Make life easier with shorthand mappings

Examples

qTip2 supports multiple shorthand notations, which allow you to write certain options in a more compact manor. For example, these two are equivalent:

$('.selector').qtip({
	content: 'My content'
});
$('.selector').qtip({
	content: {
		text: 'My content'
	}
});

As you can see, this allows you to remove the need for the additional object syntax, but means you cannot set any of the other content options. Bare this in mind when using this notation!

Complete list

On the left is the shorthand notation, and on the right what it maps to in full notation.

// Core
metadata: value, // metadata: { type: value }

// Content
content: value, // content: { text: value }
content: { title: value }, // content: { title: { text: value } }
content: { ajax: 'string' }, // content: { ajax: { url: 'string' } }

// Positioning
position: 'string', // position: { my: 'string', at: 'string' }

// Hide and show
show: true, // show: { ready: true }
show: 'string', // show: { event: 'string' }
hide: 'string', // hide: { event: 'string' }
show: $('.selector'), // show: { target: $('.selector') }
hide: $('.selector'), // hide: { target: $('.selector') }

// Styles
style: 'string', // style: { classes: 'string' }
style: { tip: value }, // style: { tip: { corner: value } }
show: { modal: value }, // show: { modal: { on: value } }