Link to home
Start Free TrialLog in
Avatar of coerrace
coerrace

asked on

jquery accordion auto adjust bar

I have this code:

http://jsbin.com/ETESUqA/6/edit

I have 2 questions:
1.-How can I do to the blue background auto expand to the width of the browser automatic no needed to do in the height. This auto width must not affect the size and position of the accordion.
2.-How can I make to return to original state of the color green of the tabs if you close all tabs because if you see if you close all tabs the last tab opened stay on gray. In other words if all the tabs closed after navigate on any tab all the tabs must have the color green of original state.
Tried to move something in CSS but I just messes the colors.
Thank you
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

1) Width of blue background full width.

Change the width of the accordion to 100% AND get rid of all the inline css and place that in your external css.  At the same time, make sure the outer tags do not limit to a specific width.
    #accordion {
        padding: 10px 100px 10px 100px;
      width: 100%;
        background-color: blue;
      
    }
You will need to play with this more but this is the idea http://jsbin.com/ETESUqA/11/edit
 
<div style="height:170px;">
        <h3 class="docs">Drag bottom right corner to resize</h3>
     
    <h2>    </h2>
        <div id="accordion">
            <h3>Section 1</h3>
            <div>
                <p>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 a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
            </div>
            <h3>Section 2</h3>
            <div>
                <p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
            </div>
            <h3>Section 3</h3>
            <div>
                <p>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. </p>
                <ul>
                    <li>List item one</li>
                    <li>List item two</li>
                    <li>List item three</li>
                </ul>
            </div>
            <h3>Section 4</h3>
            <div>
                <p>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. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
            </div>
        </div>
 
</div>
 
</div>
 
</body>
</html>
 

Open in new window

Avatar of coerrace
coerrace

ASKER

ok I tested but I if you noted doing that the problem at least here is that grow everything width including the green area the green tabs must not be affected is just the blue area.
By your side you look just width the blue area?
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Works very good thank you.