jQuery手风琴100%宽度 [英] jQuery Accordion 100% Width

查看:131
本文介绍了jQuery手风琴100%宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jQuery手风琴在我的wordpress标题。我注意到手风琴的宽度是不同的,取决于浏览器和屏幕宽度。

I have a jQuery accordion on my wordpress header. I have noticed that the width of the accordion is different depending on browsers and screen widths.

我试图通过添加'width:100%'到手风琴类来解决这个问题,但是宽度还是不能填充屏幕/标题宽度?
然而,当在chrome inspect element中编辑并在手风琴宽度中插入width:100%时,它可以工作,但是在chrome中100%的css是划掉了?

I have tried to fix this by adding 'width: 100%' to the accordion class, but the width still does not fill the screen / header width? However, when editing in 'chrome inspect element' and inserting 'width: 100%' into the accordion width, it works, but the css of 100% is "crossed out" in chrome?

请有人帮助我做错了什么?
谢谢

Please could someone assist with what I am doing incorrectly? Thank you

/* Vertical Accordion Style */
.va-container{
    position:relative;
    margin:40px auto 0 auto;
        top: -47px;
        left: 0px;
        width: 100%;
}         
.va-wrapper{
    width:100%;
    height:100%;
    position:relative;
    overflow:hidden;
    background:#000;
        left: 0px;
}
.va-slice{
    cursor:pointer;
    position:absolute;
    width:100%;
    left:0px;
    overflow:hidden;
}
.va-slice-1{
    background:#000 url(http://www.fsi.lookinside.co.za/wp-content/uploads/2013/04/Airfreight22.png) no-repeat center center;
}
.va-slice-2{
    background:#000 url(http://www.fsi.lookinside.co.za/wp-content/uploads/2013/04/Seafreight2.png) no-repeat center center;
}
.va-slice-3{
    background:#000 url(http://www.fsi.lookinside.co.za/wp-content/uploads/2013/04/Satellite.png) no-repeat center center;
}
.va-slice-4{
    background:#000 url(http://www.fsi.lookinside.co.za/wp-content/uploads/2013/04/41.jpg) no-repeat center center;
}
.va-slice-5{
    background:#000 url(http://www.fsi.lookinside.co.za/wp-content/uploads/2013/04/41.jpg) no-repeat center center;
}
.va-slice-6{
    background:#000 url(http://www.fsi.lookinside.co.za/wp-content/uploads/2013/04/41.jpg) no-repeat center center;
}
.va-slice-7{
    background:#000 url(http://www.fsi.lookinside.co.za/wp-content/uploads/2013/04/41.jpg) no-repeat center center;
}
.va-slice-color-1{
    background-color:#97c5eb;
}
.va-slice-color-2{
    background-color:#68ace5;
}
.va-slice-color-3{
    background-color:#0072cf;
}
.va-slice-color-4{
    background-color:#0039a6;
}
.va-slice-color-5{
    background-color:#00338e;
}
.va-slice-color-6{
    background-color:#002c76;
}
.va-slice-color-7{
    background-color:#002144;
}
.va-title{
    font-family: 'Open Sans Condensed', sans-serif;
    text-transform:uppercase;
    font-size:40px;
    margin-left:20px;
    color:#fff;
    text-shadow: 0px 0px 1px white;
}
.va-content{
    display:none;
    margin-left:25px;


}
.va-slice p{
    font-size: 22px;
    font-style: italic;
    font-family:Georgia, serif;
}
.va-slice ul{
    margin-top:20px;
}
.va-slice ul li{
    float:left;
    margin:0px 2px;
}
.va-slice ul li a{
    color:#000;
    background:#eede2f;
    padding:3px 6px;
    font-size:14px;
    font-family:'PT Sans', sans-serif;
    text-transform:uppercase;
}
.va-slice ul li a:hover{
    background:#000;
    color:#fff;
    text-shadow:none;
}
.va-nav span{
    width:40px;
    height:25px;
    background:transparent url(http://www.fsi.lookinside.co.za/wp-content/uploads/2013/04/prev.png) no-repeat center center;
    position:absolute;
    top:-35px;
    left:50%;
    margin-left:-20px;
    text-indent:-9000px;
    opacity:0.7;
    cursor:pointer;
    display:none;
    z-index:100;
}
.va-nav span.va-nav-next{
    background-image:url(http://www.fsi.lookinside.co.za/wp-content/uploads/2013/04/next.png);
    top:auto;
    bottom:-35px;
}
.va-nav span:hover{
    opacity:1.0;
}

/* End Additional CSS Styles */
<div class="container">

            <div id="va-accordion" class="va-container">
                <div class="va-nav">
                    <span class="va-nav-prev">Previous</span>
                    <span class="va-nav-next">Next</span>
                </div>
                <div class="va-wrapper">
                    <div class="va-slice va-slice-1">
                        <div class="va-title">Airfreight</div>
                        <div class="va-content">
                            <p>Henry Watson</p>
                            <ul>
                                <li><a href="#">About</a></li>
                                <li><a href="#">Portfolio</a></li>
                                <li><a href="#">Contact</a></li>
                            </ul>
                        </div>
                    </div>
                    <div class="va-slice va-slice-2">
                        <div class="va-title">Seafreight</div>
                        <div class="va-content">
                            <p>Keith Johnson</p>
                            <ul>
                                <li><a href="#">About</a></li>
                                <li><a href="#">Portfolio</a></li>
                                <li><a href="#">Contact</a></li>
                            </ul>
                        </div>  
                    </div>
                    <div class="va-slice va-slice-3">
                        <div class="va-title">Satellite Tracking</div>
                        <div class="va-content">
                            <p>Andrew Alaniz</p>
                            <ul>
                                <li><a href="#">About</a></li>
                                <li><a href="#">Portfolio</a></li>
                                <li><a href="#">Contact</a></li>
                            </ul>
                        </div>  
                    </div>
                    <div class="va-slice va-slice-4">
                        <div class="va-title">Guarding</div>
                        <div class="va-content">
                            <p>Ben Freeman</p>
                            <ul>
                                <li><a href="#">About</a></li>
                                <li><a href="#">Portfolio</a></li>
                                <li><a href="#">Contact</a></li>
                            </ul>
                        </div>  
                    </div>
                    <div class="va-slice va-slice-5">
                        <div class="va-title">Machine Moving</div>
                        <div class="va-content">
                            <p>Alex Schuman</p>
                            <ul>
                                <li><a href="#">About</a></li>
                                <li><a href="#">Portfolio</a></li>
                                <li><a href="#">Contact</a></li>
                            </ul>
                        </div>  
                    </div>
                    <div class="va-slice va-slice-6">
                        <div class="va-title">Investigations</div>
                        <div class="va-content">
                            <p>Maria Wales</p>
                            <ul>
                                <li><a href="#">About</a></li>
                                <li><a href="#">Portfolio</a></li>
                                <li><a href="#">Contact</a></li>
                            </ul>
                        </div>  
                    </div>
                    <div class="va-slice va-slice-7">
                        <div class="va-title">Transport</div>
                        <div class="va-content">
                            <p>Paul White</p>
                            <ul>
                                <li><a href="#">About</a></li>
                                <li><a href="#">Portfolio</a></li>
                                <li><a href="#">Contact</a></li>
                            </ul>
                        </div>  
                    </div>
                </div>
            </div>

        </div>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
        <script type="text/javascript" src="wp-content/themes/FSI5/jquery.easing.1.3.js"></script>
        <script type="text/javascript" src="wp-content/themes/FSI5/jquery.mousewheel.js"></script>
        <script type="text/javascript" src="wp-content/themes/FSI5/jquery.vaccordion.js"></script>
        <script type="text/javascript">
            $(function() {
                $('#va-accordion').vaccordion({
                    visibleSlices   : 5,
                    expandedHeight  : 250,
                    animOpacity     : 0.1,
                    contentAnimSpeed: 100
                });
            });
        </script>             


推荐答案

您需要为您的手风琴设置包装将包装器宽度设置为100%

you will need to set a wrapper for your accordion and set the wrapper width to 100%

<div class="container">
<div id="va-accordion" class="va-container">
...stuff...
</div>
</div>

.container {width:100% !important;}

因为手风琴宽度是基于其包装器

this happens because the accordion width is based on its wrapper

,您还将wanto删除您的 .va-container 类,将其属性置于 .container 类中

you will also wanto to delete your .va-container class and put its properties in the .container class

.container {
width:100% !important;
position:relative;
    margin:40px auto 0 auto;
        top: -47px;
        left: 0px;
}

这篇关于jQuery手风琴100%宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆