[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/jquery_ui/jquery.ui.old/ui/ -> effects.fold.js (source)

   1  /*

   2   * jQuery UI Effects Fold 1.6

   3   *

   4   * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)

   5   * Dual licensed under the MIT (MIT-LICENSE.txt)

   6   * and GPL (GPL-LICENSE.txt) licenses.

   7   *

   8   * http://docs.jquery.com/UI/Effects/Fold

   9   *

  10   * Depends:

  11   *    effects.core.js

  12   */
  13  (function($) {
  14  
  15  $.effects.fold = function(o) {
  16  
  17      return this.queue(function() {
  18  
  19          // Create element

  20          var el = $(this), props = ['position','top','left'];
  21  
  22          // Set options

  23          var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode

  24          var size = o.options.size || 15; // Default fold size

  25          var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value

  26  
  27          // Adjust

  28          $.effects.save(el, props); el.show(); // Save & Show

  29          var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper

  30          var widthFirst = ((mode == 'show') != horizFirst);
  31          var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];
  32          var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
  33          var percent = /([0-9]+)%/.exec(size);
  34          if(percent) size = parseInt(percent[1]) / 100 * distance[mode == 'hide' ? 0 : 1];
  35          if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift

  36  
  37          // Animation

  38          var animation1 = {}, animation2 = {};
  39          animation1[ref[0]] = mode == 'show' ? distance[0] : size;
  40          animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
  41  
  42          // Animate

  43          wrapper.animate(animation1, o.duration / 2, o.options.easing)
  44          .animate(animation2, o.duration / 2, o.options.easing, function() {
  45              if(mode == 'hide') el.hide(); // Hide

  46              $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore

  47              if(o.callback) o.callback.apply(el[0], arguments); // Callback

  48              el.dequeue();
  49          });
  50  
  51      });
  52  
  53  };
  54  
  55  })(jQuery);


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7