I’m trying to create a dropdown kind of menu.So on clicking on a div menu fades in and on click again it fadesOut,
but fading out doesn’t seem to work properly…
$(document).ready(function(){
$('#clickable_div').click(function() {
var $somediv = $('#nav_menu');
if($somediv.is(':visible')){
$somediv.hide().fadeOut(300);
}else{
var $this = $(this);
$('#nav_menu').css({
display:'block',
top: $this.offset().top + $this.height(),
left: $this.offset().left,
position: 'absolute'
}).show();
$('#nav_menu').hide().fadeIn(300);
}
});
});
tried working on your script and below are the changes made by me.
EDIT: Check DEMO here jsfiddle