hi, i've a function that when i click on a link a div shows up, and it works nice, but when i click on the div itself the div closes up, and other "bug" is, that if i have 2 or more divs if i click on one link and click on other link the div's stays visible, how can i solve this?
here is the code: jQuery.fn.DivMenu = function(opcoes){ /** * **/ var variaveis = { 'display' : 'none', 'position' : 'absolute', 'background' : '#fff', 'border' : '1px solid #cecece', 'font-family' : 'Verdana, Arial, Helvetica, sans-serif', 'font-size' : '11px; padding: 5px; z-index: 999999' }; var opcoes = $.extend({}, variaveis, opcoes); /** end **/ /** * **/ return this.each(function(){ /** * **/ var element = this; var offset = $(element).offset(); var left = offset.left; var top = offset.top; var currentId = $(this).attr('id'); var divDados = currentId + '-dados'; /** end **/ /** * **/ $(element).click(function(){ $('#' + divDados).hide(); $(this).next ().show(); return false; }); $(document.body).click(function(){ $('#' + divDados).hide(); }); /** end **/ /** * **/ $('#' + divDados).css({ 'left' : left + 'px', 'top' : top + 15 + 'px', 'display' : opcoes['display'], 'position' : opcoes['position'], 'background' : opcoes['background'], 'border' : opcoes['border'], 'font-family' : opcoes['font-family'], 'font-size' : opcoes['font_size'] }); /** end **/ }); /** end **/ }; this is my first function so be nice to me ;)