开发者

jquery hide my content

开发者 https://www.devze.com 2023-02-09 06:02 出处:网络
Hello all i have made a tab menu in my sidebar (follow a tutorial), but i have now use code开发者_如何学运维igniter to echo out some result from the database..

Hello all i have made a tab menu in my sidebar (follow a tutorial), but i have now use code开发者_如何学运维igniter to echo out some result from the database..

but the tab menu hide my content, but i can see it in the source

This is what i can see in the source

<div style="border-bottom:1px solid #e0e0e0; width:200px; height:100px;" class="sidebarForumWrapper">

    headline text here  

    <div style="border:1px solid #e0e0e0; padding:5px;" class="sidebarForumImg">
        <img width="20" height="20" src="">
    </div>

    <!-- sidebarForumImg -->

    text text text
</div>

<!-- sidebarForumWrapper --> 

and the tab function

<script style="text/javascript">    
    $(function() {
        // setting the tabs in the sidebar hide and show, setting the current tab
            $('div.tabbed div').hide();
            $('div.t1').show();
            $('div.tabbed ul.tabs li.t1 a').addClass('tab-current');

        // SIDEBAR TABS
        $('div.tabbed ul li a').click(function(){
            var thisClass = this.className.slice(0,2);
            $('div.tabbed div').hide();
            $('div.' + thisClass).show();
            $('div.tabbed ul.tabs li a').removeClass('tab-current');
            $(this).addClass('tab-current');
            });
        });
     </script>

if you want you can see my site live here http://www.rapcom.dk


Your problem is with this line:

$('div.tabbed div').hide();

This would display: none ALL the divs under tabbed, instead use:

$('div.tabbed > div').hide();

But I recommend you reconsider your Tabs approach and use the jQuery UI Tabs or at least using the same approach where the <a> tags will point to the id of the corresponding DIV content container.


$('div.tabbed div').hide();

remove this line of code and try again

0

精彩评论

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