I am trying to make a simple slide effect but it is not working the way I want, please help me out. if anyone can point me in the right direction i would appreciate it.
what I want to do is have the div slide up as one div not 2 div. when you click on a button the div slides down/up before the arrow head, I would like both the arrow head and the div to slide up/down.
when the user clicks on a button the other open div slides up before the clicked button div slides down.
here is an example of my work.
DEMO: http://jsfiddle.net/dSCxJ/
<div id="main_content">
<ul class="categories_list">
<li class="animated">
<a href="#propsal_templates" class="main_buttons">
<span class="category_list_titles">
<table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="150" align="center" valign="middle">Proposal Templates</td>
</tr>
</table>
</span>
</a>
</li>
<li class="animated">
<a href="#2" class="main_buttons">
<span class="category_list_titles">
<table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="150" align="center" valign="middle">Site Lists</td>
</tr>
</table>
</span>
</a>
</li>
</ul>
<div id="propsal_templates" class="document_wrapper" style="display:none;">
<div class="chat-bubble-arrow-border1"></div>
<div class="chat-bubble-arrow1"></div>
<table width="950" border="0" cellspacing="10" cellpadding="10">
<tr>
<td width="316" valign="middle">
<a href="test.docx">
<span class="icon powerpoint_icon"></span>
<span class="doc_name">General</span>
</a>
</td>
<td width="316" valign="middle">
<a href="test.docx">
<span class="icon pdf_icon"></span>
<span class="doc_name">General</span>
</a>
</td>
<td width="310" valign="middle">
<a href="test.docx">
<span class="icon excel_icon"></span>
<span class="doc_name">General</span>
</a>
</td>
</tr>
<tr>
<td valign="middle">
<a href="test.docx">
<span class="icon word_icon"></span>
<span class="doc_name">General</span>
</a>
</td>
<td valign="middle">
<a href="test.docx">
<span class="icon powerpoint_icon"></span>
<span class="doc_name">General</span>
</a>
</td>
<td valign="middle">
<a href="test.docx">
<span class="icon powerpoint_icon"></span>
<span class="doc_name">General</span>
</a>
</td>
</tr>
<tr>
<td valign="middle">
<a href="test.docx">
<span class="icon word_icon"></span>
<span class="doc_name">General</span>
</a>
</td>
<td valign="middle">
<a href="test.docx">
<span class="icon powerpoint_icon"></span>
<span class="doc_name">General</span>
</a>
</td>
<td valign="middle">
</td>
</tr>
</table>
</div>
<div id="2" class="document_wrapper" style="display:none;">
<div class="chat-bubble-arrow-border2"></div>
<div class="chat-bubble-arrow2"></div>
<table width="950" border="0" cellspacing="10" cellpadding="10">
<tr>
<td width="316" valign="middle">
<a href="test.docx">
<span class="icon powerpoint_icon"></span>
<span class="doc_name">General</span>
</a>
</td>
<td width="316" valign="middle">
<a href="test.docx">
<span class="icon pdf_icon"></span>
<span class="doc_name">General</span>
</a>
</td>
<td width="310" valign="middle">
<a href="test.docx">
<span class="icon excel_icon"></span>
<span class="doc_name">General</span>
</a>
</td>
</tr>
<tr>
<td valign="middle">
<a href="test.docx">
<span class="icon word_icon"></span>
<span class="doc_name">General</span>
</a>
</td>
<td valign="middle">
<a href="test.docx">
<span class="icon powerpoint_icon"></span>
<span class="doc_name">General</span>
</a>
</td>
<td valign="middle">
<a href="test.docx">
<span class="icon pdf_icon"></span>
<span class="doc_name">General</span>
</a>
</td>
</tr>
</table>
</div>
//centers categories names
jQuery.fn.center = function(){
this.css("position","absolute");
this.css("top","50%");
this.css("left","50%");
this.css("margin-top","-"+(this.height()/2)+"px");
this.css("margin-left","-"+(this.width()/2)+"px");
return this;
}
$(".category_list_titles").center();
//button action
$('ul.categories_list li a.main_buttons').click(function(e) {
e.preventDefault();
var div = $(this).attr("href");
//alert(div);
if($(this).hasClass('selected_button'))
{
$(this).removeClass('selected_button');
//$(''+div+'').fadeOut();
$(''+div+'').slideUp(
{
duration: 500,
easing: 'easeInQuad',
}
);
}
else
{
$('ul.categories_list li a.main_buttons').each(function(i) {
$('ul.categories_list li a.main_buttons').removeClass('selected_button');
//$('.document_wrapper').css('display', 'none');
$('.document_wrapper').slideUp(
{
duration: 500,
easing: 'easeInQuad',
}
);
});
$(this).addClass('selected_button');
//$(''+div+'').fadeIn();
$(''+div+'').slideDown(
{
duration: 500,
easing: 'easeInQuad',
}
);
}
});
thanks in advance