开发者

jquery tabs inside a floating div not showing up properly

i can get tabs working fine in straight htm file with no floats. when i add a left & right container side by side the tabs get messed up. The content gets displayed outside of the tab div underneath it.

jquery tabs inside a floating div not showing up properly

here is the code, anyone solve this issue? i found similar things but nothing exactly like what i am accomplishing. jquery 1.6.4

<link href="css/jquery-ui-1.8.15.custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>


    <script type="text/javascript">
    $(function ($)
    {
        $('#tabs').tabs();
    });
</script>

    <br />

    <a href="cheer.htm" style="margin-left:10px;">
        <img border="0" src="images/cheerleadingjrchiefs3sm.gif" width="180" height="92" alt="" />
    </a>

</div>
<div id="rightContainer">
    <div id="tabs">
        <ul>
            <li><a href="#tabs-1">Nunc tincidunt</a></li>
            <li><a href="#tabs-2">Proin dolor</a></li>
            <li><a href="#tabs-3">Aenean lacinia</a></li>
        </ul>
        <div id="tabs-1">
            <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
        </div>
        <div id="tabs-2">
   开发者_如何学C         <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
        </div>
        <div id="tabs-3">
            <p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p>
            <p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
        </div>
    </div>
</div>    

styles:

    #navMenu
{
    list-style-type:none;
    font-size:1.2em;
    font-weight:bold;
    margin-left: 10px;
    height: 297px;
}

#navMenu li
{
    padding-bottom:5px;
}

#leftContainer
{
    width:210px;
    float:left;
    background-image: url("../images/jrchiefsbg.gif");
    background-repeat:repeat;
}


#rightContainer
{
    margin-left:220px;
}

two of the many styles in the included jquery stylesheet

.ui-helper-clearfix:after {
    clear: both;
    content: ".";
    display: block;
    height: 0;
    visibility: hidden;
}

.ui-helper-clearfix {
    display: block;
}

i used firebug to remove the clear: both; on the class .ui-helper-clearfix:after and it put everything where it is suppose to be minus the actual background gray color

jquery tabs inside a floating div not showing up properly

now the only problem is that the gray background isn't behind the whole li element


Basically, try a "float: right" on your right col.

If that doesn't work, consider making a fiddle, it's much easier to understand stuff when you can debug the code right away.


So after fiddling with CSS on the page in firebug I couldn't get it perfect. I switched to http://flowplayer.org/tools/tabs/index.html

Came out real nice using the non image CSS. To work with the image tabs I would have to resice the actual tab image to get what I needed inside the right container.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜