Avatar of Mike Eghtebas
Mike Eghtebas
Flag for United States of America asked on

HTML, Bootstrap, accordion, trouble shoot

The following is supposed to display the header lines keeping its sub-items collapsed. And, when the top-line is clicked on it is supposed to drop down to display its sub-items. The problem is that the following html file displays all items in expanded mode. So, it fails to acct like accordion control (expand/ collapse).

Question: How can this be fixed?
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>My EE Certifications</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <style>
          #accordion {
        width:50%;
        height: 50px;
        line-height: 50px;
        vertical-align: middle;
      }

      img {
        float:left;
      }

  </style>
  <script>

   $(function() {
    $( "#accordion" ).accordion({
      heightStyle: "content",collapsible: true
      });
            $("#foo").click();
  });
  
  </script>
</head>
<body>


<div id="accordion">
  <h3 id="foo"><img src="images/genius.png" alt="" />Genius1,000,000</h3>
  <div>
    <ul>
      <li>Microsoft Access Database</li>
    </ul>
  </div>
  <h3><img src="images/sage.png" alt="" />Sage500,000</h3>
  <div>
    <p>
Microsoft Access Database
    </p>
  </div>
  <h3 id="bar"><img src="images/wizard.png" alt="" />Wizard300,000 </h3>
  <div>
    <ul>
      <li>Microsoft Access Database</li>
    </ul>
  </div>
  <h3><img src="images/guru.png" alt="" />Guru150,000</h3>
  <div>
    <ul>
<li>Microsoft Access Database</li>
<li>Access Forms</li>
<li>Access Coding/Macros</li>
</ul>

  </div>
    <h3><img src="images/master.png" alt="" />Master50,000 </h3>
  <div>
    <ul>
<li>Microsoft Access Database</li>
<li>Access Forms</li>
<li>Access Coding/Macros</li>
<li>SQL Query Syntax</li>
<li>Access Reports</li>
<li>.NET</li>
<li>C# Programming Language</li>
<li>MS SQL Server</li>
<li>Programming for ASP.NET</li>
</ul>
  </div>
</div>

</body>
</html>

Open in new window

\
The attached image are not mandatory to include.
HTMLCSSJavaScriptBootstrap

Avatar of undefined
Last Comment
Jeff Darling

8/22/2022 - Mon
SOLUTION
Habib Pourfard

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Mike Eghtebas

ASKER
What other files?

I have only this html file + the image files. The images show alright meaning the get loaded.

Mike
Mike Eghtebas

ASKER
Now I see the js files. So, what can I do about this?
Mike Eghtebas

ASKER
I changed:
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
to
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>

Now it is working.

Could you explain when https: is required and when it is not?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Habib Pourfard

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
this should work properly. the browser automatically uses http on ordinary pages, and https on secure pages.

I'm not too sure why this happens for you while it's working for me. may be you are using an old browser.
ASKER CERTIFIED SOLUTION
Jeff Darling

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.