Title of tabs appear on the right side of vertical accordion

Deadly 提交于 2019-12-24 18:36:28

问题


What's going on?: The accordion is working properly, but the tabs show up on the right side of the accordion.

jQuery

$(document).ready(function(){
    $(".accordion .title").click(function(){
        $(this).next(".accordion .details").slideToggle(500)
    }).next().hide();
});  

CSS: Hoverbox

.hoverbox
{
    cursor: default;
    list-style: none;
} .hoverbox a {
    padding-top: 5px;
    cursor: default;
    text-decoration: none;
    color: black;
} .hoverbox a .preview {
    display: none;
} .hoverbox a:hover .preview {
    display: block;
    position: absolute;
    top: -33px;
    left: -45px;
    z-index: 1;
} .hoverbox img {
    vertical-align: top;
    height: 125px;
} .hoverbox li {
    display: inline;
    float: left;
    margin: 3px;
    padding: 5px;
    position: relative;
    text-align: right;
    text-decoration: none;
} .hoverbox .preview {
    border-color: #000;
    height: 300px;
} .gallery {
    width: 100%;
}

HTML: A sample for one image.

<div class="accordion">
    <div class="title"><h2></h2></div>
    <ul class="details">
    <div class="gallery">
    <ul class="hoverbox">
        <li>
        <a href="#">
            <img src="pictures/1.jpg" class="thumbnail"/>
            <img src="pictures/1.jpg" class="preview"/></br>
            Compass
        </a>
        </li>
    </ul>
    </div>
    </ul>
</div>

First, let's start off with a just loaded accordion.

After I click "Glass Windows", this is what happens.

What I have done: For the past four or five days I have been spending many hours relocating <div> tags, making sure my code is correct and dabbling with the CSS (specifically making sure the text wasn't aligned oddly or there was something goofy about how the images were displayed). Not very specific, I know. I apologize for the not so short and concise question.


Update

I attempted to use Dexter's suggestion, but I still keep having issues with the text alignment.

After clicking on Section 1...

And Section 2...

As stated before, each section should be underneath one another. The Videos section is separate from the accordion and Home is a part of the navigation list at the bottom of the page (serves as the footer).

I've come to understand that this may be an issue with my CSS for everything else not accordion related. Since I have no idea what's the problem, I will just upload the entire CSS (which is about the same length as the accordion CSS)... if of course, that is 'okay'.


回答1:


So, is this what you're trying to achieve?

See fiddle here: http://jsfiddle.net/GRATx/

EDIT:

Code in fiddle [updated with hoverbox functionality]: http://jsfiddle.net/GRATx/1/



来源:https://stackoverflow.com/questions/11171296/title-of-tabs-appear-on-the-right-side-of-vertical-accordion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!