Ver Mensaje Individual
  #8 (permalink)  
Antiguo 29/12/2010, 13:14
Avatar de chicohot20
chicohot20
 
Fecha de Ingreso: mayo-2009
Mensajes: 388
Antigüedad: 14 años, 10 meses
Puntos: 43
Respuesta: problema con menu en jquery

a verlo dicho antes pense que te referias a los textos que le metiste en las opciones, estuve jugando un poco con el codigo fuente de kwicks, aunque no funciona con jQuery 1.4, reemplaza este codigo que te adjunto en jquery.kwicks-1.5.1.pack.js
En la linea 24 estan los anchos para cada opcion, puedes cambiarlos:
Código Javascript:
Ver original
  1. /*
  2.     Kwicks for jQuery (version 1.5.1)
  3.     Copyright (c) 2008 Jeremy Martin
  4.     http://www.jeremymartin.name/projects.php?project=kwicks
  5.    
  6.     Licensed under the MIT license:
  7.         http://www.opensource.org/licenses/mit-license.php
  8.  
  9.     Any and all use of this script must be accompanied by this copyright/license notice in its present form.
  10. */
  11.  
  12.  
  13. (function($){
  14.     $.fn.kwicks = function(options) {
  15.         var defaults = {
  16.             isVertical: false,
  17.             sticky: false,
  18.             defaultKwick: 0,
  19.             event: 'mouseover',
  20.             spacing: 0,
  21.             duration: 500
  22.            
  23.         };
  24.         var widths=[100,150,200,250,300,350];
  25.         var o = $.extend(defaults, options);
  26.         var WoH = (o.isVertical ? 'height' : 'width'); // WoH = Width or Height
  27.         var LoT = (o.isVertical ? 'top' : 'left'); // LoT = Left or Top
  28.        
  29.         return this.each(function() {
  30.             container = $(this);
  31.             var kwicks = container.children('despl li');
  32.             var normWoH = kwicks.eq(0).css(WoH).replace(/px/,''); // normWoH = Normal Width or Height
  33.             if(!o.max) {
  34.                 o.max = (normWoH * kwicks.size()) - (o.min * (kwicks.size() - 1));
  35.             } else {
  36.                 o.min = ((normWoH * kwicks.size()) - o.max) / (kwicks.size() - 1);
  37.             }
  38.             // set width of container ul
  39.             if(o.isVertical) {
  40.                 container.css({
  41.                     width : kwicks.eq(0).css('width'),
  42.                     height : (normWoH * kwicks.size()) + (o.spacing * (kwicks.size() - 1)) + 'px'
  43.                 });            
  44.             } else {
  45.                 container.css({
  46.                     width : (normWoH * kwicks.size()) + (o.spacing * (kwicks.size() - 1)) + 'px',
  47.                     height : kwicks.eq(0).css('height')
  48.                 });            
  49.             }
  50.  
  51.             // pre calculate left or top values for all kwicks but the first and last
  52.             // i = index of currently hovered kwick, j = index of kwick we're calculating
  53.             var preCalcLoTs = []; // preCalcLoTs = pre-calculated Left or Top's
  54.             for(i = 0; i < kwicks.size(); i++) {
  55.                 preCalcLoTs[i] = [];
  56.                 // don't need to calculate values for first or last kwick
  57.                 for(j = 1; j < kwicks.size() - 1; j++) {
  58.                     if(i == j) {
  59.                         preCalcLoTs[i][j] = o.isVertical ? j * o.min + (j * o.spacing) : j * o.min + (j * o.spacing);
  60.                     } else {
  61.                         preCalcLoTs[i][j] = (j <= i ? (j * o.min) : (j-1) * o.min + o.max) + (j * o.spacing);
  62.                     }
  63.                 }
  64.             }
  65.            
  66.             // loop through all kwick elements
  67.             kwicks.each(function(i) {
  68.                 var kwick = $(this);
  69.                 // set initial width or height and left or top values
  70.                 // set first kwick
  71.                 if(i === 0) {
  72.                     kwick.css(LoT, '0px');
  73.                 }
  74.                 // set last kwick
  75.                 else if(i == kwicks.size() - 1) {
  76.                     kwick.css(o.isVertical ? 'bottom' : 'right', '0px');
  77.                 }
  78.                 // set all other kwicks
  79.                 else {
  80.                     if(o.sticky) {
  81.                         kwick.css(LoT, preCalcLoTs[o.defaultKwick][i]);
  82.                     } else {
  83.                         kwick.css(LoT, (i * normWoH) + (i * o.spacing));
  84.                     }
  85.                 }
  86.                 // correct size in sticky mode
  87.                 if(o.sticky) {
  88.                     if(o.defaultKwick == i) {
  89.                         kwick.css(WoH, o.max + 'px');
  90.                         kwick.addClass('active');
  91.                     } else {
  92.                         kwick.css(WoH, o.min + 'px');
  93.                     }
  94.                 }
  95.                 kwick.css({
  96.                     margin: 0,
  97.                     position: 'absolute'
  98.                 });
  99.                
  100.                 kwick.bind(o.event, function() {
  101.                     // calculate previous width or heights and left or top values
  102.                     var prevWoHs = []; // prevWoHs = previous Widths or Heights
  103.                     var prevLoTs = []; // prevLoTs = previous Left or Tops
  104.                     kwicks.stop().removeClass('active');
  105.                     for(j = 0; j < kwicks.size(); j++) {
  106.                         prevWoHs[j] = kwicks.eq(j).css(WoH).replace(/px/, '');
  107.                         prevLoTs[j] = kwicks.eq(j).css(LoT).replace(/px/, '');
  108.                     }
  109.                     var aniObj = {};
  110.                    
  111.                     var pcurrent = $(this);
  112.                     var pabort = false;
  113.                     var pi=0;
  114.                     while (!pabort) {
  115.                         if (pcurrent.prev().length!=0){      
  116.                             pi++;
  117.                             pcurrent=pcurrent.prev();
  118.                         }
  119.                         else pabort = true;
  120.                     }
  121.                     aniObj[WoH] = widths[pi];
  122.                    
  123.                     var maxDif = o.max - prevWoHs[i];
  124.                     var prevWoHsMaxDifRatio = prevWoHs[i]/maxDif;
  125.                     kwick.addClass('active').animate(aniObj, {
  126.                         step: function(now) {
  127.                             // calculate animation completeness as percentage
  128.                             var percentage = maxDif != 0 ? now/maxDif - prevWoHsMaxDifRatio : 1;
  129.                             // adjsut other elements based on percentage
  130.                             kwicks.each(function(j) {
  131.                                 if(j != i) {
  132.                                     kwicks.eq(j).css(WoH, prevWoHs[j] - ((prevWoHs[j] - o.min) * percentage) + 'px');
  133.                                 }
  134.                                 if(j > 0 && j < kwicks.size() - 1) { // if not the first or last kwick
  135.                                     kwicks.eq(j).css(LoT, prevLoTs[j] - ((prevLoTs[j] - preCalcLoTs[i][j]) * percentage) + 'px');
  136.                                 }
  137.                             });
  138.                         },
  139.                         duration: o.duration,
  140.                         easing: o.easing
  141.                     });
  142.                 });
  143.             });
  144.             if(!o.sticky) {
  145.                 container.bind("mouseleave", function() {
  146.                     var prevWoHs = [];
  147.                     var prevLoTs = [];
  148.                     kwicks.removeClass('active').stop();
  149.                     for(i = 0; i < kwicks.size(); i++) {
  150.                         prevWoHs[i] = kwicks.eq(i).css(WoH).replace(/px/, '');
  151.                         prevLoTs[i] = kwicks.eq(i).css(LoT).replace(/px/, '');
  152.                     }
  153.                     var aniObj = {};
  154.                     aniObj[WoH] = normWoH;
  155.                     var normDif = normWoH - prevWoHs[0];
  156.                     kwicks.eq(0).animate(aniObj, {
  157.                         step: function(now) {
  158.                             var percentage = normDif != 0 ? (now - prevWoHs[0])/normDif : 1;
  159.                             for(i = 1; i < kwicks.size(); i++) {
  160.                                 kwicks.eq(i).css(WoH, prevWoHs[i] - ((prevWoHs[i] - normWoH) * percentage) + 'px');
  161.                                 if(i < kwicks.size() - 1) {
  162.                                     kwicks.eq(i).css(LoT, prevLoTs[i] - ((prevLoTs[i] - ((i * normWoH) + (i * o.spacing))) * percentage) + 'px');
  163.                                 }
  164.                             }
  165.                         },
  166.                         duration: o.duration,
  167.                         easing: o.easing
  168.                     });
  169.                 });
  170.             }
  171.         });
  172.     };
  173. })(jQuery);