Accordion control...

I have three accordion controls on a page. The 1st and second one have first section expanded which is okay. The 3rd one also showing its first section expanded.

Question: How can I have the 3rd one collapsed?

 final
<!DOCTYPE html>
<html><head><title>Certificates...</title>

    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
   <link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
  <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script> 
  <!--<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>  -->
	<link rel="stylesheet" type="text/css" href="./styles/resume.css"/>
	  
  <style>
          .accordion{
        width:100%;
        line-height: 50px;
        vertical-align: middle;
      }

      img {
        float:left;
      }

  </style>
  <script>

   $(function() {
    $( ".accordion-div" ).accordion({
      heightStyle: "content",collapsible: true
      });
	  //$(".foo").click();	
            var headers = $('#accordion h3.ui-accordion-header');
    $('.ui-accordion-header-icon', headers).removeClass('ui-icon-triangle-1-s').addClass('ui-icon-triangle-1-e');
    headers.next().slideUp();
		
  });
  
  </script>
</head>
<body>
<div class="content">

		<div class="btn-group-vertical">
			<a href="index.html" class="btn btn-default">Resume</a>
			<a href="Videos.html" class="btn btn-default">Videos...</a>
			<a href="Projects.html" class="btn btn-default">Projects...</a>
			<a href="certificate.html" class="current btn btn-default">Certificates...</a>
			<a href="more.html" class="btn btn-default">More...</a>

				<div class="btn-group">
					<a href="#" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
						Download
						<span class="caret"></span>
					</a>
					<ul class="dropdown-menu">
						<li><a href="resources/Resume_Mike_Eghtebas_March15_2015.docx">Resume.docx</a></li>
						<li><a href="resources/Resume_Mike_Eghtebas_March15_2015.pdf" target="_blank">Resume.pdf</a></li>
					</ul>
				</div>

		</div>
		
	<div class="wrapper">
   
        <div class="left-col">&nbsp;
		</div> <!-- <div class="left-col"> -->

		<div class="verticalGapTop">&nbsp;</div>

		<div class="right-col nameBlock">
			<p>
				<span class="name">Mike M Eghtebas</span><br>
				<span class="title">Database Development & Web Programming</span><br>
			</P>
		</div> <!-- <div class="right-col nameBlock"> -->
           
		<div class="horizontalGap">&nbsp;</div>   

		<div class="left-colBottom">
                
		</div> <!-- <div class="left-colBottom"> -->
 			
		<div class="verticalGapBottom">&nbsp;</div>

		<div class="right-colBottom">

			<p class="name"><br>Certificates:</p>
			<div class="accordion-div">
           
				<h1>Microsoft</h1>
				<div id="accordion" class="accordion-div">
				<h2 class="foo">Microsoft Technology Associate, MTA 98-364</h2>
				
				<div>
					<ul>
					  <li>
						MTA Database track, data platyform adminstration and business intelligence.
						Passed on January 2015. <a href="./images/mta.png" target="_blank"><abbr title="Certificate">MTA 98-364</abbr></a>
					  </li>
					</ul>
				</div>
				<h3>Querying Microsoft SQL Server 2012</h3>
				<div>
					<p>
						
						Querying Microsoft SQL Server 2012<br>
						Recived <a id="A4a" href="./images/certNHZ.png" target="_blank"><abbr title="Certificate of completion">Certificate of Completion</abbr></a>
						for course 20-461 covering: <br>
						Create database objects (tables, views, indexes, constraints, etc.)<br>
						Queries (select, sub-queries, implement data types, aggregate queries, xml data)<br>
						Scheduled to pass Microsoft Exam 70-461 on December 22, 2015.
						
					</p>
				</div>
			</div><!-- <div class="accordion-div"> -->
			</div>
		  <hr>
		  
			<div class="accordion-div">
         
				<h1>Expert Exchange</h1>
				<div id="accordion2" class="accordion-div">
				<h2 class="foo">Master 50,000 points (count: 11)</h2>
				
			  <div>
				<ul>
					<li><a href="resources/eeCertificates.pdf#page=15"  target="_blank">1. Programming for ASP.NET </a></li>
					<li><a href="resources/eeCertificates.pdf#page=13"  target="_blank">2. C# Programming Language</a>  </li>
					<li><a href="resources/eeCertificates.pdf#page=16"  target="_blank">3. VB.NET Programming</a> </li>
					<li><a href="resources/eeCertificates.pdf#page=12"  target="_blank">4. .NET</a> </li>
					<li><a href="resources/eeCertificates.pdf#page=14"  target="_blank">5. MS SQL Server</a></li>
					<li><a href="resources/eeCertificates.pdf#page=17"  target="_blank">6. MS SQL Server 2008 Access</a></li>
					<li><a href="resources/eeCertificates.pdf#page=10"  target="_blank">7. SQL Query Syntax</a></li>
					<li><a href="resources/eeCertificates.pdf#page=9"  target="_blank">8. Access Coding/Macros</a></li>
					<li><a href="resources/eeCertificates.pdf#page=8"  target="_blank">9. Access Forms</a></li>
					<li><a href="resources/eeCertificates.pdf#page=11"  target="_blank">10. Access Reports</a></li>
					<li><a href="resources/eeCertificates.pdf#page=7"  target="_blank">11. Microsoft Access Database</a></li>
				</ul>
			  </div>
			  
				<h2 class="foo">Guru 150,000 points (count: 3)</h2>
			  <div>
				<ul>
					<li><a href="resources/eeCertificates.pdf#page=4"  target="_blank">12. Microsoft Access Database</a></li>
					<li><a href="resources/eeCertificates.pdf#page=5"  target="_blank">13. Access Forms</a></li>
					<li><a href="resources/eeCertificates.pdf#page=6"  target="_blank">14. Access Coding/Macros</a></li>
				</ul>
			  </div>
			  
				<h2 class="foo">Wizard 300,000 points  (count: 1)</h2>
			  <div>
				<ul>
					<li><a href="resources/eeCertificates.pdf#page=3"  target="_blank">15. Microsoft Access Database</a></li>
				</ul>
			  </div>

				<h2 class="foo">Sage 500,000 points (count: 1)</h2>
				
			  <div>
				<ul>
					<li><a href="resources/eeCertificates.pdf#page=2"  target="_blank">16. Microsoft Access Database</a></li>
				</ul>
			  </div>
			  
				<h2 class="foo">Genius 1,000,000 points (count: 1)</h2>
				
			  <div>
				<ul>
					<li><a href="resources/eeCertificates.pdf#page=1"  target="_blank">17. Microsoft Access Database</a></li>
				</ul>
			  </div>				  
		
			</div><!-- <div class="accordion-div"> -->
			</div>		
			<hr>
		  <!--<a id="SampelEEQA"></a><br/><br/>-->
		  <div class="accordion-div">
           
				<h1>Sample questions I have answered at experts-exchange.com online</h1>
				<div id="accordion3" class="accordion-div">
				
				<!--<div>-->
							  	<ul>
				<li><a href="http://www.experts-exchange.com/questions/28736828/SQL-Update-Query.html"  target="_blank">SQL Update Query</a></li>
				<li><a href="http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_28490785.htm"  target="_blank">User control event firing multiple times asp.net c#</a></li>
				<li><a href="http://www.experts-exchange.com/questions/28554419/SQL-Server-2008-R2-Strip-most-all-text-but-keep-specific-text.html"  target="_blank">SQL Server 2008 R2 - Strip most all text but keep specific text</a></li>
				
				<li><a href="http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_28562310.html"  target="_blank">MVC - combining two field in a drop down from joint table</a></li>
				<li><a href="http://www.experts-exchange.com/Database/MySQL/Q_28580999.html"  target="_blank">Mysql, ordering results by the highest score (inner query)</a></li>
				<li><a href="http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_28616110.html"  target="_blank">Values only change when i use the mouse</a></li>
				
				<li><a href="http://www.experts-exchange.com/questions/28678994/SQL-Query-Syntax.html"  target="_blank">SQL Query Syntax</a></li>
				<li><a href="http://www.experts-exchange.com/questions/28728284/Access-2003-query-long-list-of-or-not-working.html"  target="_blank">Access 2003 query, long list of "or" not working</a></li>
				<li><a href="http://www.experts-exchange.com/questions/28719106/SQL-Script-help.html"  target="_blank">SQL Script help</a></li>
				
				<li><a href="http://www.experts-exchange.com/questions/28714509/Link-two-temp-tables-to-get-a-result-set.html"  target="_blank">Link two temp tables to get a result set</a></li>
				<li><a href="http://www.experts-exchange.com/questions/28712738/How-to-Club-Rows-in-One-Row-As-Others-SQL-Server.html"  target="_blank">How to Club Rows in One Row As Others - SQL Server</a></li>
				<li><a href="http://www.experts-exchange.com/questions/28705867/Select-first-occurrence-of-record-in-SQL-Server.html"  target="_blank">Select first occurrence of record in SQL Server</a></li>
				
				<li><a href="http://www.experts-exchange.com/questions/28705198/TRIM-out-of-a-text-Field.html"  target="_blank">TRIM ; out of a text Field</a></li>
				<li><a href="http://www.experts-exchange.com/questions/28704621/find-duplicate-column-within-a-group.html"  target="_blank">find duplicate column within a group</a></li>
				<li><a href="http://www.experts-exchange.com/questions/28704135/Insert-Record-if-no-records-found-SQL.html"  target="_blank">Insert Record if no records found - SQL</a></li>
				
				<li><a href="http://www.experts-exchange.com/questions/28703780/TOP-N-BY-GROUP.html"  target="_blank">TOP N BY GROUP</a></li>
				<li><a href="http://www.experts-exchange.com/questions/28701762/IIF-to-include-Null-Values-from-Table.html"  target="_blank">IIF to include Null Values from Table</a></li>
				<li><a href="http://www.experts-exchange.com/questions/28701002/How-to-remove-then-re-add-table-constrains.html"  target="_blank">How to remove, then re-add table constrain</a></li>
				
				<li><a href="http://www.experts-exchange.com/questions/28699373/sql-DateDiff-help.html"  target="_blank">sql DateDiff help</a></li>
				<li><a href="http://www.experts-exchange.com/questions/28697920/T-SQL-CTE-for-finding-Parent-Prior-Peer-Next-Peer-Child.html"  target="_blank">T-SQL CTE for finding Parent, Prior Peer, Next Peer, Child</a></li>
				<li><a href="http://www.experts-exchange.com/questions/28695999/SQL-2005-Exclude-records-from-Select.html"  target="_blank">SQL 2005 - Exclude records from Select</a></li>
				
				<li><a href="http://www.experts-exchange.com/questions/28695595/SQL-Server-Transpose-partially-at-least.html"  target="_blank">SQL Server Transpose , partially at least</a></li>
				<li><a href="http://www.experts-exchange.com/questions/28694746/User-Defined-Function.html"  target="_blank">User Defined Function</a></li>
	
			</ul>
				</div>
			</div><!-- <div class="accordion-div"> 
			</div>-->
		
		  
			  
		  <!--	-->
		</div> <!-- <div class="right-colBottom"> -->
	</div> <!-- <div class="wrapper"> -->

	<div class="footer"> 
        <div class="note"><span>September 2015 update, single page</span> </div>
		<div class="cssLogo"><img style="border:0;width:44px;height:15px" src="http://jigsaw.w3.org/css-validator/images/vcss-blue"  alt="Valid CSS!" /> </div>
	</div>

</div><!-- <div class="content"> -->
</body>
</html>

Open in new window


html edited for the 3rd control
LVL 34
Mike EghtebasDatabase and Application DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
Hi,
here we go - simply replace your (function ...) completely with this:
   $(function() {
    // open all but the last two
    $( ".accordion-div" ).slice(0,-2).accordion({
      heightStyle: "content",
	  collapsible: true
    });
	// Set active state false for the last two accords
	$( ".accordion-div" ).slice(-2).accordion({
      heightStyle: "content",
	  collapsible: true,
	  active: false
    });
	 });

Open in new window


HTH
Rainer
EE_QAccord2.html

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.