Project

General

Profile

Download (23.3 KB) Statistics
| Branch: | Tag: | Revision:
1
/*
2
 * jQuery clueTip plugin
3
 * Version 0.9.6  (02/02/2008)
4
 * @requires jQuery v1.1.1+
5
 * @requires Dimensions plugin 
6
 *
7
 * Dual licensed under the MIT and GPL licenses:
8
 * http://www.opensource.org/licenses/mit-license.php
9
 * http://www.gnu.org/licenses/gpl.html
10
 *
11
 */
12
(function($) { 
13
/*
14
 * @name clueTip
15
 * @type jQuery
16
 * @cat Plugins/tooltip
17
 * @return jQuery
18
 * @author Karl Swedberg
19
 *
20
 * @credit Inspired by Cody Lindley's jTip (http://www.codylindley.com)
21
 * @credit Thanks to the following people for their many and varied contributions:
22
      Shelane Enos, Glen Lipka, Hector Santos, Torben Schreiter, Dan G. Switzer, Jörn Zaefferer 
23
 * @credit Thanks to Jonathan Chaffer, as always, for help with the hard parts. :-)
24
 */
25

    
26
 /**
27
 * 
28
 * Displays a highly customizable tooltip when the user hovers (default) or clicks (optional) the matched element. 
29
 * By default, the clueTip plugin loads a page indicated by the "rel" attribute via ajax and displays its contents.
30
 * If a "title" attribute is specified, its value is used as the clueTip's heading.
31
 * The attribute to be used for both the body and the heading of the clueTip is user-configurable. 
32
 * Optionally, the clueTip's body can display content from an element on the same page.
33
 * * Just indicate the element's id (e.g. "#some-id") in the rel attribute.
34
 * Optionally, the clueTip's body can display content from the title attribute, when a delimiter is indicated. 
35
 * * The string before the first instance of the delimiter is set as the clueTip's heading.
36
 * * All subsequent strings are wrapped in separate DIVs and placed in the clueTip's body.
37
 * The clueTip plugin allows for many, many more options. Pleasee see the examples and the option descriptions below...
38
 * 
39
 * 
40
 * @example $('#tip).cluetip();
41
 * @desc This is the most basic clueTip. It displays a 275px-wide clueTip on mouseover of the element with an ID of "tip." On mouseout of the element, the clueTip is hidden.
42
 *
43
 *
44
 * @example $('a.clue').cluetip({
45
 *  hoverClass: 'highlight',
46
 *  sticky: true,
47
 *  closePosition: 'bottom',
48
 *  closeText: '<img src="cross.png" alt="close" />',
49
 *  truncate: 60,
50
 *  ajaxSettings: {
51
 *    type: 'POST'
52
 *  }
53
 * });
54
 * @desc Displays a clueTip on mouseover of all <a> elements with class="clue". The hovered element gets a class of "highlight" added to it (so that it can be styled appropriately. This is esp. useful for non-anchor elements.). The clueTip is "sticky," which means that it will not be hidden until the user either clicks on its "close" text/graphic or displays another clueTip. The "close" text/graphic is set to diplay at the bottom of the clueTip (default is top) and display an image rather than the default "Close" text. Moreover, the body of the clueTip is truncated to the first 60 characters, which are followed by an ellipsis (...). Finally, the clueTip retrieves the content using POST rather than the $.ajax method's default "GET."
55
 * 
56
 * More examples can be found at http://plugins.learningjquery.com/cluetip/demo/
57
 * 
58
 * Full list of options/settings can be found at the bottom of this file and at http://plugins.learningjquery.com/cluetip/
59
 */
60

    
61
  var $cluetip, $cluetipInner, $cluetipOuter, $cluetipTitle, $cluetipArrows, $dropShadow, imgCount;
62
  $.fn.cluetip = function(options) {
63

    
64
    var opts = $.extend({},$.fn.cluetip.defaults, options);
65

    
66
    if (options && options.ajaxSettings) {
67
      $.extend(opts.ajaxSettings, options.ajaxSettings);
68
      delete options.ajaxSettings;
69
    }
70
    
71
    if (options && options.hoverIntent) {
72
      $.extend(opts.hoverIntent, options.hoverIntent);
73
      delete options.hoverIntent;
74
    }    
75

    
76
    if (options && options.fx) {
77
      $.extend(opts.fx, options.fx);
78
      delete options.fx;
79
    }
80
    
81
    return this.each(function(index) {
82
      // start out with no contents (for ajax activation)
83
      var cluetipContents = false;
84
      var cluezIndex = parseInt(opts.cluezIndex, 10)-1;
85
      var isActive = false, closeOnDelay = 0;
86

    
87
      // create the cluetip divs
88
      if (!$cluetip) {
89
        $cluetipInner = $('<div id="cluetip-inner"></div>');
90
        $cluetipTitle = $('<h3 id="cluetip-title"></h3>');        
91
        $cluetipOuter = $('<div id="cluetip-outer"></div>').append($cluetipInner).prepend($cluetipTitle);
92
        $cluetip = $('<div id="cluetip"></div>').css({zIndex: opts.cluezIndex})
93
        .append($cluetipOuter).append('<div id="cluetip-extra"></div>')[insertionType](insertionElement).hide();
94
        $('<div id="cluetip-waitimage"></div>').css({position: 'absolute', zIndex: cluezIndex-1})
95
        .insertBefore('#cluetip').hide();
96
        $cluetip.css({position: 'absolute', zIndex: cluezIndex});
97
        $cluetipOuter.css({position: 'relative', zIndex: cluezIndex+1});
98
        $cluetipArrows = $('<div id="cluetip-arrows" class="cluetip-arrows"></div>').css({zIndex: cluezIndex+1}).appendTo('#cluetip');
99
      }
100
      var dropShadowSteps = (opts.dropShadow) ? +opts.dropShadowSteps : 0;
101
      if (!$dropShadow) {
102
        $dropShadow = $([]);
103
        for (var i=0; i < dropShadowSteps; i++) {
104
          $dropShadow = $dropShadow.add($('<div></div>').css({zIndex: cluezIndex-i-1, opacity:.1, top: 1+i, left: 1+i}));
105
        };
106
        $dropShadow.css({position: 'absolute', backgroundColor: '#000'})
107
        .prependTo($cluetip);
108
      }
109
      var $this = $(this);
110
      var tipAttribute = $this.attr(opts.attribute), ctClass = opts.cluetipClass;
111
      if (!tipAttribute && !opts.splitTitle) return true;
112
      // if hideLocal is set to true, on DOM ready hide the local content that will be displayed in the clueTip
113
      if (opts.local && opts.hideLocal) { $(tipAttribute + ':first').hide(); }
114
      var tOffset = parseInt(opts.topOffset, 10), lOffset = parseInt(opts.leftOffset, 10);
115
      // vertical measurement variables
116
      var tipHeight, wHeight;
117
      var defHeight = isNaN(parseInt(opts.height, 10)) ? 'auto' : (/\D/g).test(opts.height) ? opts.height : opts.height + 'px';
118
      var sTop, linkTop, posY, tipY, mouseY, baseline;
119
      // horizontal measurement variables
120
      var tipInnerWidth = isNaN(parseInt(opts.width, 10)) ? 275 : parseInt(opts.width, 10);
121
      var tipWidth = tipInnerWidth + (parseInt($cluetip.css('paddingLeft'))||0) + (parseInt($cluetip.css('paddingRight'))||0) + dropShadowSteps;
122
      var linkWidth = this.offsetWidth;
123
      var linkLeft, posX, tipX, mouseX, winWidth;
124
            
125
      // parse the title
126
      var tipParts;
127
      var tipTitle = (opts.attribute != 'title') ? $this.attr(opts.titleAttribute) : '';
128
      if (opts.splitTitle) {
129
        if(tipTitle == undefined) {tipTitle = '';}
130
        tipParts = tipTitle.split(opts.splitTitle);
131
        tipTitle = tipParts.shift();
132
      }
133
      var localContent;
134
      
135

    
136
/***************************************      
137
* ACTIVATION
138
****************************************/
139
    
140
//activate clueTip
141
    var activate = function(event) {
142
      if (!opts.onActivate($this)) {
143
        return false;
144
      }
145
      isActive = true;
146
      $cluetip.removeClass().css({width: tipInnerWidth});
147
      if (tipAttribute == $this.attr('href')) {
148
        $this.css('cursor', opts.cursor);
149
      }
150
      $this.attr('title','');
151
      if (opts.hoverClass) {
152
        $this.addClass(opts.hoverClass);
153
      }
154
      linkTop = posY = $this.offset().top;
155
      linkLeft = $this.offset().left;
156
      mouseX = event.pageX;
157
      mouseY = event.pageY;
158
      if ($this[0].tagName.toLowerCase() != 'area') {
159
        sTop = $(document).scrollTop();
160
        winWidth = $(window).width();
161
      }
162
// position clueTip horizontally
163
      if (opts.positionBy == 'fixed') {
164
        posX = linkWidth + linkLeft + lOffset;
165
        $cluetip.css({left: posX});
166
      } else {
167
        posX = (linkWidth > linkLeft && linkLeft > tipWidth)
168
          || linkLeft + linkWidth + tipWidth + lOffset > winWidth 
169
          ? linkLeft - tipWidth - lOffset 
170
          : linkWidth + linkLeft + lOffset;
171
        if ($this[0].tagName.toLowerCase() == 'area' || opts.positionBy == 'mouse' || linkWidth + tipWidth > winWidth) { // position by mouse
172
          if (mouseX + 20 + tipWidth > winWidth) {  
173
            $cluetip.addClass(' cluetip-' + ctClass);
174
            posX = (mouseX - tipWidth - lOffset) >= 0 ? mouseX - tipWidth - lOffset - parseInt($cluetip.css('marginLeft'),10) + parseInt($cluetipInner.css('marginRight'),10) :  mouseX - (tipWidth/2);
175
          } else {
176
            posX = mouseX + lOffset;
177
          }
178
        }
179
        var pY = posX < 0 ? event.pageY + tOffset : event.pageY;
180
        $cluetip.css({left: (posX > 0 && opts.positionBy != 'bottomTop') ? posX : (mouseX + (tipWidth/2) > winWidth) ? winWidth/2 - tipWidth/2 : Math.max(mouseX - (tipWidth/2),0)});
181
      }
182
        wHeight = $(window).height();
183

    
184
/***************************************
185
* load the title attribute only (or user-selected attribute). 
186
* clueTip title is the string before the first delimiter
187
* subsequent delimiters place clueTip body text on separate lines
188
***************************************/
189
      if (tipParts) {
190
        var tpl = tipParts.length;
191
        for (var i=0; i < tpl; i++){
192
          if (i == 0) {
193
            $cluetipInner.html(tipParts[i]);
194
          } else { 
195
            $cluetipInner.append('<div class="split-body">' + tipParts[i] + '</div>');
196
          }            
197
        };
198
        cluetipShow(pY);
199
      }
200
/***************************************
201
* load external file via ajax          
202
***************************************/
203
      else if (!opts.local && tipAttribute.indexOf('#') != 0) {
204
        if (cluetipContents && opts.ajaxCache) {
205
          $cluetipInner.html(cluetipContents);
206
          cluetipShow(pY);
207
        }
208
        else {
209
          var ajaxSettings = opts.ajaxSettings;
210
          ajaxSettings.url = tipAttribute;
211
          ajaxSettings.beforeSend = function() {
212
            $cluetipOuter.children().empty();
213
            if (opts.waitImage) {
214
              $('#cluetip-waitimage')
215
              .css({top: mouseY+20, left: mouseX+20})
216
              .show();
217
            }
218
          };
219
         ajaxSettings.error = function() {
220
            if (isActive) {
221
              $cluetipInner.html('<i>sorry, the contents could not be loaded</i>');
222
            }
223
          };
224
          ajaxSettings.success = function(data) {
225
            cluetipContents = opts.ajaxProcess(data);
226
            if (isActive) {
227
              $cluetipInner.html(cluetipContents);
228
            }
229
          };
230
          ajaxSettings.complete = function() {
231
          	imgCount = $('#cluetip-inner img').length;
232
        		if (imgCount) {
233
        		  $('#cluetip-inner img').load( function(){
234
          			imgCount--;
235
          			if (imgCount<1) {
236
          				$('#cluetip-waitimage').hide();
237
          			  if (isActive) cluetipShow(pY);
238
          			}
239
        		  }); 
240
        		} else {
241
      				$('#cluetip-waitimage').hide();
242
        		  if (isActive) cluetipShow(pY);    
243
        		} 
244
          };
245
          $.ajax(ajaxSettings);
246
        }
247

    
248
/***************************************
249
* load an element from the same page
250
***************************************/
251
      } else if (opts.local){
252
        var $localContent = $(tipAttribute + ':first');
253
        var localCluetip = $.fn.wrapInner ? $localContent.wrapInner('<div></div>').children().clone(true) : $localContent.html();
254
        $.fn.wrapInner ? $cluetipInner.empty().append(localCluetip) : $cluetipInner.html(localCluetip);
255
        cluetipShow(pY);
256
      }
257
    };
258

    
259
// get dimensions and options for cluetip and prepare it to be shown
260
    var cluetipShow = function(bpY) {
261
      $cluetip.addClass('cluetip-' + ctClass);
262
      
263
      if (opts.truncate) { 
264
        var $truncloaded = $cluetipInner.text().slice(0,opts.truncate) + '...';
265
        $cluetipInner.html($truncloaded);
266
      }
267
      function doNothing() {}; //empty function
268
      tipTitle ? $cluetipTitle.show().html(tipTitle) : (opts.showTitle) ? $cluetipTitle.show().html('&nbsp;') : $cluetipTitle.hide();
269
      if (opts.sticky) {
270
        var $closeLink = $('<div id="cluetip-close"><a href="#">' + opts.closeText + '</a></div>');
271
        (opts.closePosition == 'bottom') ? $closeLink.appendTo($cluetipInner) : (opts.closePosition == 'title') ? $closeLink.prependTo($cluetipTitle) : $closeLink.prependTo($cluetipInner);
272
        $closeLink.click(function() {
273
          cluetipClose();
274
          return false;
275
        });
276
        if (opts.mouseOutClose) {
277
          if ($.fn.hoverIntent && opts.hoverIntent) { 
278
            $cluetip.hoverIntent({
279
              over: doNothing, 
280
              timeout: opts.hoverIntent.timeout,  
281
              out: function() { $closeLink.trigger('click'); }
282
            });
283
          } else {
284
            $cluetip.hover(doNothing, 
285
            function() {$closeLink.trigger('click'); });
286
          }
287
        } else {
288
          $cluetip.unbind('mouseout');
289
        }
290
      }
291
// now that content is loaded, finish the positioning 
292
      var direction = '';
293
      $cluetipOuter.css({overflow: defHeight == 'auto' ? 'visible' : 'auto', height: defHeight});
294
      tipHeight = defHeight == 'auto' ? $cluetip.outerHeight() : parseInt(defHeight,10);   
295
      tipY = posY;
296
      baseline = sTop + wHeight;
297
      if (opts.positionBy == 'fixed') {
298
        tipY = posY - opts.dropShadowSteps + tOffset;
299
      } else if ( (posX < mouseX && Math.max(posX, 0) + tipWidth > mouseX) || opts.positionBy == 'bottomTop') {
300
        if (posY + tipHeight + tOffset > baseline && mouseY - sTop > tipHeight + tOffset) { 
301
          tipY = mouseY - tipHeight - tOffset;
302
          direction = 'top';
303
        } else { 
304
          tipY = mouseY + tOffset;
305
          direction = 'bottom';
306
        }
307
      } else if ( posY + tipHeight + tOffset > baseline ) {
308
        tipY = (tipHeight >= wHeight) ? sTop : baseline - tipHeight - tOffset;
309
      } else if ($this.css('display') == 'block' || $this[0].tagName.toLowerCase() == 'area' || opts.positionBy == "mouse") {
310
        tipY = bpY - tOffset;
311
      } else {
312
        tipY = posY - opts.dropShadowSteps;
313
      }
314
      if (direction == '') {
315
        posX < linkLeft ? direction = 'left' : direction = 'right';
316
      }
317
      $cluetip.css({top: tipY + 'px'}).removeClass().addClass('clue-' + direction + '-' + ctClass).addClass(' cluetip-' + ctClass);
318
      if (opts.arrows) { // set up arrow positioning to align with element
319
        var bgY = (posY - tipY - opts.dropShadowSteps);
320
        $cluetipArrows.css({top: (/(left|right)/.test(direction) && posX >=0 && bgY > 0) ? bgY + 'px' : /(left|right)/.test(direction) ? 0 : ''}).show();
321
      } else {
322
        $cluetipArrows.hide();
323
      }
324

    
325
// (first hide, then) ***SHOW THE CLUETIP***
326
      $dropShadow.hide();
327
      $cluetip.hide()[opts.fx.open](opts.fx.open != 'show' && opts.fx.openSpeed);
328
      if (opts.dropShadow) $dropShadow.css({height: tipHeight, width: tipInnerWidth}).show();
329
      if ($.fn.bgiframe) { $cluetip.bgiframe(); }
330
      // trigger the optional onShow function
331
      if (opts.delayedClose > 0) {
332
        closeOnDelay = setTimeout(cluetipClose, opts.delayedClose);
333
      }
334

    
335
      opts.onShow($cluetip, $cluetipInner);
336
      
337
    };
338

    
339
/***************************************
340
   =INACTIVATION
341
-------------------------------------- */
342
    var inactivate = function() {
343
      isActive = false;
344
      $('#cluetip-waitimage').hide();
345
      if (!opts.sticky || (/click|toggle/).test(opts.activation) ) {
346
        cluetipClose();
347
clearTimeout(closeOnDelay);        
348
      };
349
      if (opts.hoverClass) {
350
        $this.removeClass(opts.hoverClass);
351
      }
352
      $('.cluetip-clicked').removeClass('cluetip-clicked');
353
    };
354
// close cluetip and reset some things
355
    var cluetipClose = function() {
356
      $cluetipOuter 
357
      .parent().hide().removeClass().end()
358
      .children().empty();
359
      if (tipTitle) {
360
        $this.attr('title', tipTitle);
361
      }
362
      $this.css('cursor','');
363
      if (opts.arrows) $cluetipArrows.css({top: ''});
364
    };
365

    
366
/***************************************
367
   =BIND EVENTS
368
-------------------------------------- */
369
  // activate by click
370
      if ( (/click|toggle/).test(opts.activation) ) {
371
        $this.click(function(event) {
372
          if ($cluetip.is(':hidden') || !$this.is('.cluetip-clicked')) {
373
            activate(event);
374
            $('.cluetip-clicked').removeClass('cluetip-clicked');
375
            $this.addClass('cluetip-clicked');
376

    
377
          } else {
378
            inactivate(event);
379

    
380
          }
381
          this.blur();
382
          return false;
383
        });
384
  // activate by focus; inactivate by blur    
385
      } else if (opts.activation == 'focus') {
386
        $this.focus(function(event) {
387
          activate(event);
388
        });
389
        $this.blur(function(event) {
390
          inactivate(event);
391
        });
392
  // activate by hover
393
    // clicking is returned false if cluetip url is same as href url
394
      } else {
395
        $this.click(function() {
396
          if ($this.attr('href') && $this.attr('href') == tipAttribute && !opts.clickThrough) {
397
            return false;
398
          }
399
        });
400
        //set up mouse tracking
401
        var mouseTracks = function(evt) {
402
          if (opts.tracking == true) {
403
            var trackX = posX - evt.pageX;
404
            var trackY = tipY ? tipY - evt.pageY : posY - evt.pageY;
405
            $this.mousemove(function(evt) {
406
              $cluetip.css({left: evt.pageX + trackX, top: evt.pageY + trackY });
407
            });
408
          }
409
        };
410
        if ($.fn.hoverIntent && opts.hoverIntent) {
411
          $this.mouseover(function() {$this.attr('title',''); })
412
          .hoverIntent({
413
            sensitivity: opts.hoverIntent.sensitivity,
414
            interval: opts.hoverIntent.interval,  
415
            over: function(event) {
416
              activate(event);
417
              mouseTracks(event);
418
            }, 
419
            timeout: opts.hoverIntent.timeout,  
420
            out: function(event) {inactivate(event); $this.unbind('mousemove');}
421
          });           
422
        } else {
423
          $this.hover(function(event) {
424
            activate(event);
425
            mouseTracks(event);
426
          }, function(event) {
427
            inactivate(event);
428
            $this.unbind('mousemove');
429
          });
430
        }
431
      }
432
    });
433
  };
434
  
435
/*
436
 * options for clueTip
437
 *
438
 * each one can be explicitly overridden by changing its value. 
439
 * for example: $.fn.cluetip.defaults.width = 200; 
440
 * would change the default width for all clueTips to 200. 
441
 *
442
 * each one can also be overridden by passing an options map to the cluetip method.
443
 * for example: $('a.example').cluetip({width: 200}); 
444
 * would change the default width to 200 for clueTips invoked by a link with class of "example"
445
 *
446
 */
447
  
448
  $.fn.cluetip.defaults = {  // set up default options
449
    width:            275,      // The width of the clueTip
450
    height:           'auto',   // The height of the clueTip
451
    cluezIndex:       97,       // Sets the z-index style property of the clueTip
452
    positionBy:       'auto',   // Sets the type of positioning: 'auto', 'mouse','bottomTop', 'fixed'
453
    topOffset:        15,       // Number of px to offset clueTip from top of invoking element
454
    leftOffset:       15,       // Number of px to offset clueTip from left of invoking element
455
    local:            false,    // Whether to use content from the same page for the clueTip's body
456
    hideLocal:        true,     // If local option is set to true, this determines whether local content
457
                                // to be shown in clueTip should be hidden at its original location
458
    attribute:        'rel',    // the attribute to be used for fetching the clueTip's body content
459
    titleAttribute:   'title',  // the attribute to be used for fetching the clueTip's title
460
    splitTitle:       '',       // A character used to split the title attribute into the clueTip title and divs
461
                                // within the clueTip body. more info below [6]
462
    showTitle:        true,     // show title bar of the clueTip, even if title attribute not set
463
    cluetipClass:     'default',// class added to outermost clueTip div in the form of 'cluetip-' + clueTipClass.
464
    hoverClass:       '',       // class applied to the invoking element onmouseover and removed onmouseout
465
    waitImage:        true,     // whether to show a "loading" img, which is set in jquery.cluetip.css
466
    cursor:           'help',
467
    arrows:           false,    // if true, displays arrow on appropriate side of clueTip
468
    dropShadow:       true,     // set to false if you don't want the drop-shadow effect on the clueTip
469
    dropShadowSteps:  6,        // adjusts the size of the drop shadow
470
    sticky:           false,    // keep visible until manually closed
471
    mouseOutClose:    false,    // close when clueTip is moused out
472
    activation:       'hover',  // set to 'click' to force user to click to show clueTip
473
                                // set to 'focus' to show on focus of a form element and hide on blur
474
    clickThrough:     false,    // if true, and activation is not 'click', then clicking on link will take user to the link's href,
475
                                // even if href and tipAttribute are equal
476
    tracking:         false,    // if true, clueTip will track mouse movement (experimental)
477
    delayedClose:     0,        // close clueTip on a timed delay (experimental)
478
    closePosition:    'top',    // location of close text for sticky cluetips; can be 'top' or 'bottom' or 'title'
479
    closeText:        'Close',  // text (or HTML) to to be clicked to close sticky clueTips
480
    truncate:         0,        // number of characters to truncate clueTip's contents. if 0, no truncation occurs
481

    
482
    // effect and speed for opening clueTips
483
    fx: {             
484
                      open:       'show', // can be 'show' or 'slideDown' or 'fadeIn'
485
                      openSpeed:  ''
486
    },     
487

    
488
    // settings for when hoverIntent plugin is used             
489
    hoverIntent: {    
490
                      sensitivity:  3,
491
              			  interval:     50,
492
              			  timeout:      0
493
    },
494

    
495
    // function to run just before clueTip is shown.           
496
    onActivate:       function(e) {return true;},
497

    
498
    // function to run just after clueTip is shown.
499
    onShow:           function(ct, c){},
500
    
501
    // whether to cache results of ajax request to avoid unnecessary hits to server    
502
    ajaxCache:        true,  
503

    
504
    // process data retrieved via xhr before it's displayed
505
    ajaxProcess:      function(data) {
506
                        data = data.replace(/<s(cript|tyle)(.|\s)*?\/s(cript|tyle)>/g, '').replace(/<(link|title)(.|\s)*?\/(link|title)>/g,'');
507
                        return data;
508
    },                
509

    
510
    // can pass in standard $.ajax() parameters, not including error, complete, success, and url
511
    ajaxSettings: {   
512
                      dataType: 'html'
513
    }
514
  };
515

    
516

    
517
/*
518
 * Global defaults for clueTips. Apply to all calls to the clueTip plugin.
519
 *
520
 * @example $.cluetip.setup({
521
 *   insertionType: 'prependTo',
522
 *   insertionElement: '#container'
523
 * });
524
 * 
525
 * @property
526
 * @name $.cluetip.setup
527
 * @type Map
528
 * @cat Plugins/tooltip
529
 * @option String insertionType: Default is 'appendTo'. Determines the method to be used for inserting the clueTip into the DOM. Permitted values are 'appendTo', 'prependTo', 'insertBefore', and 'insertAfter'
530
 * @option String insertionElement: Default is 'body'. Determines which element in the DOM the plugin will reference when inserting the clueTip.
531
 *
532
 */
533
   
534
  var insertionType = 'appendTo', insertionElement = 'body';
535
  $.cluetip = {};
536
  $.cluetip.setup = function(options) {
537
    if (options && options.insertionType && (options.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)) {
538
      insertionType = options.insertionType;
539
    }
540
    if (options && options.insertionElement) {
541
      insertionElement = options.insertionElement;
542
    }
543
  };
544
  
545
})(jQuery);
(3-3/7)