Witam. Napisałem prosty plug-in w JQuery i mam malutki problem smile.gif . Otóż nie wiem jak określić właściwość "top" w css rzecz jasna za pomocą JQuery.
Kod wygląda następująco:
Kod
hook = '.menu';
button = '.btn';

$('ul' + hook).each( function(){
$(this).hide();
});

$(button).click( function(){
  button = $(this);
    $('ul' + hook).each( function(){
      if(button.attr('name') == $(this).attr('name')){
        position = $(button).offset();
        left = position.left + button.outerWidth() - $(this).outerWidth();
        top = position.top + button.outerHeight() - $(this).outerHeight();
        
        if(button.attr('menu-position') == 'right'){
          left = position.left;
          top = position.top + button.outerHeight();
        }
        
        if(button.attr('menu-position') == 'left'){
          left = position.left + button.outerWidth() - $(this).outerWidth();
          top = position.top + button.outerHeight() - $(this).outerHeight();
        }
        
        if(button.attr('menu-position') == 'center'){
          half = $(this).outerWidth() / 2;
          halftwo = button.outerWidth() / 2;
          left = position.left - half + halftwo;
          top = position.top + button.outerHeight() - $(this).outerHeight();
        }
        
        $(this).css("top", top);
        $(this).css("left", left);
      if($(this).is(':hidden')){
       $(this).show();
      }else{
        $(this).hide();
      }
      }
    });
});

Otóż 'left' jest określany prawidłowo, a 'top' w ogóle nie jest określany. Powiedzcie co robię nie tak. Z góry dzięki za pomoc!