javascript - jquery accordion formatting differently -


<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js" language="javascript"></script> <script type="text/javascript" src="http://www.compactcourse.com/js/accordionnew.js" language="javascript"></script> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />  <h1>toggle panels</h1> <div id="notaccordion"> <h3><a href="#">section 1</a></h3> <div>  mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. integer ut neque. vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. nam nibh. donec suscipit eros. nam mi. proin viverra leo ut odio. curabitur malesuada. vestibulum velit eu ante scelerisque vulputate.  </div> <h3><a href="#">section 2</a></h3> <div>  sed non urna. donec et ante. phasellus eu ligula. vestibulum sit amet purus. vivamus hendrerit, dolor @ aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. vivamus non quam. in suscipit faucibus urna.  </div> <h3><a href="#">section 3</a></h3> <div>  nam enim risus, molestie et, porta ac, aliquam ac, risus. quisque lobortis. phasellus pellentesque purus in massa. aenean in pede. phasellus ac libero ac tellus pellentesque semper. sed ac felis. sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. <ul>     <li>list item one</li>     <li>list item two</li>     <li>list item three</li> </ul> </div> <h3><a href="#">section 4</a></h3> <div>  cras dictum. pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; aenean lacinia mauris vel est.  suspendisse eu nisl. nullam ut libero. integer dignissim consequat lectus. class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.  </div> </div> 

the above code i've put raw html code box on 1 page of wordpress site. here's link: compactcourse.com/sloths

as can see, jquery accordions don't normal format should like. if paste code above raw html editor, preview show how should normally. ideas why screwing up?

some of website's css interfering jquery-ui css. of css rules used site's theme more specific , therefore overwrite of css rules being imported link tag @ top of html code.

that explain why code looks fine in raw html editor (which not loading additional resources / stylesheets) not on site. need track down css theme interfering , alter either markup or css accordingly.

here few guides / primers concept of css specificity:

edit: obvious problem see margin on bottom of accordion's h3 headings daniel pointed out in answer. code theme css causing problem this:

div.entry-content h3, div.entry-content h4,  div.entry-content h5, div.entry-content h6 {      margin: 0 0 15px;  } 

to fix need overwrite margin h3 tags within accordion. adding css rule page should it:

#notaccordion h3 {      margin-bottom: 0;  } 

you can either put in between <style></style> tags or add 1 of external stylesheets loaded theme on page. former rather sloppy method page's code pretty horrible cobbled-together codepasta nightmare standards perspective wouldn't making things worse.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -