![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
![]() Grupa: Zarejestrowani Postów: 82 Pomógł: 1 Dołączył: 19.10.2011 Ostrzeżenie: (0%) ![]() ![]() |
Witam. Napisałem prosty plug-in w JQuery i mam malutki problem
![]() 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! |
|
|
![]() ![]() |
![]() |
Aktualny czas: 20.08.2025 - 06:25 |