[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/libraries/jquery/ -> jquery.additions.js (source)

   1  /**
   2   * jQuery additions
   3   */
   4  ;(function($){  
   5  
   6    /** 
   7     * Position the first element in the jQuery list near another element  
   8     * using absolute positioning. The element should already have the  
   9     * proper z-Index set. 
  10     *  
  11     * @param string align 'bottom' for bottom left, or 'right' for top right, 
  12     *    'left' for top left, 'top' for above left. 
  13     */  
  14    $.fn.makePositioned = function(align, element) {  
  15      var first = this.eq(0);  
  16      var pos, height, width, left, top, thisHeight, thisWidth;  
  17      pos = element.offset();  
  18      height = element.outerHeight(), width = element.outerWidth();  
  19      left = pos.left, top = pos.top;  
  20      thisHeight = first.outerHeight(), thisWidth = first.outerWidth();  
  21  
  22      switch (align) {   
  23        case 'bottom':  
  24          top += height;  
  25        break;  
  26        case 'right':  
  27          left += width;  
  28        break;  
  29        case 'left':  
  30          left = left - thisWidth;  
  31        break;  
  32        case 'top':  
  33          top = top - thisHeight;  
  34        break;  
  35      }  
  36  
  37      first.css({   
  38        top: parseInt(top)+'px',   
  39        left: parseInt(left)+'px',  
  40        position: 'absolute'  
  41      });  
  42  
  43      return this;  
  44    }  
  45  
  46  })(jQuery);


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1