简体   繁体   English

带jQuery的CSS3滑块构造器

[英]CSS3 slider constructor with jquery

I need to do, to make it look like this 我需要做,使它看起来像这样

在此处输入图片说明

And this how it looked now 这就是现在的样子

http://fiddle.jshell.net/Nazaret2005/Zn2Lx/show/ or http://fiddle.jshell.net/Nazaret2005/aeJjL/show/ http://fiddle.jshell.net/Nazaret2005/Zn2Lx/show/http://fiddle.jshell.net/Nazaret2005/aeJjL/show/

The broblem is: If i do with One ul and two or more li , the slide container go over the next li. 问题是:如果我处理一个ul和两个或更多个li ,则滑动容器将越过下一个li。 (here the example http://fiddle.jshell.net/Nazaret2005/aeJjL/ ) (此处为示例http://fiddle.jshell.net/Nazaret2005/aeJjL/

And if i do with One ul and one li in all the information, have to make the gap between ul (here the example http://fiddle.jshell.net/Nazaret2005/Zn2Lx/ ). 如果我在所有信息中都使用一个ul和一个li ,则必须在ul之间进行区分(此处是示例http://fiddle.jshell.net/Nazaret2005/Zn2Lx/ )。

How can i make it, like in screenshot ? 我怎样才能做到,如截图所示? Thanks 谢谢

So... This is my approach, using the template you already built: 所以...这是我的方法,使用您已经构建的模板:

I move the class green from li to span 我把绿色的班级从李调到了

<li>
    <span class="OpenClose green">Novembr 2013 <cc>&#x25B2;</cc></span>
    <div class="orange">Some information here 2<a title="Download file 11" href="./download.php?file_id=11"></a>
    </div>
</li>

I removed the height of li 我删除了李的身高

#download_j li {
    width: 300px;
    margin: 0 0 7px 0;
}

And i set the margin left of the inside div to 5px 我将内部div的左边距设置为5px

#download_j li div {
    display: none;
    width: 705px;
    height: 30px;
    margin: 0 0 7px 5px;
    background: #F7F5F2;
    font-size: 18px;
    color: #333;
    padding: 10px 0 0 20px;
    text-decoration: none;
    position:relative;
}

You can check it out here: http://fiddle.jshell.net/aeJjL/7/ 您可以在这里查看: http : //fiddle.jshell.net/aeJjL/7/

css only solution 仅限CSS的解决方案

HTML HTML

<section class="container">
    <div>
        <input id="nov13" type="checkbox" />
        <label for="nov13">Nov 2013</label>
        <article class="small">
            <p>other elements here </p>
        </article>
    </div>
    <div>
        <input id="dec13" type="checkbox" />
        <label for="dec13">Dec 2013</label>
        <article class="medium">
            <p>other elements here</p>
        </article>
    </div>
    <div><!--...--></div>
</section>

CSS CSS

.container{
    font-family: calibri;
    width: 400px;
    margin: 10px auto 30px auto;
}
.container label{
    padding: 5px 20px;
    position: relative;
    z-index: 20;
    display: block;
    height: 30px;
    cursor: pointer;
    color: #777;
    line-height: 33px;
    font-size: 19px;
    background: #eee;
}
.container label:hover{
    background: #fff;
}
.container input:checked + label,
.container input:checked + label:hover{
    background: #c6e1ec;
    color: #3d7489;
}
.container label:hover:after,
.container input:checked + label:hover:after{
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    right: 13px;
    top: 7px;
    background: transparent url(your_path/arrow_down.png) no-repeat center center;  
}
.container input:checked + label:hover:after{
    background-image: url(your_path/arrow_up.png);
}
.container input{
    display: none;
}
.container article{
    background: rgba(255, 255, 255, 0.5);
    margin-top: -1px;
    overflow: hidden;
    height: 0px;
    position: relative;
    z-index: 10;
    transition: 
        height 0.3s ease-in-out, 
        box-shadow 0.6s linear;
}
.container input:checked ~ article{
    transition: 
        height 0.5s ease-in-out,
}
.container article p{
    font-style: italic;
    color: #777;
    line-height: 23px;
    font-size: 14px;
    padding: 20px;
}
.container input:checked ~ article.small{
    height: 140px;
}
.container input:checked ~ article.medium{
    height: 180px;
}

DEMO DEMO

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM