How to get a slideToggle effect with jQuery?

2

In this link , I have some red stripes in specialty. I would like to ask what effect I'm going to use for a div to replace the content of the strings individually with a slideToggle effect from left to right. How to get this script in jQuery?

    
asked by anonymous 19.08.2014 / 13:42

1 answer

3

Start with something like this:

jquery:

$('.disparador').click(function () {
    $(this).animate({
        width: ($(this).width() == 200 ? 100 : 200)
    });
    $(this).siblings('.painel').animate({
        width: 'toggle'
    });
});

HTML:

<div class='container'>
    <div class='painel'>Lorem ipsum dolor sit amet.</div>
    <div class='disparador'></div>
</div>

<div class='container'>
    <div class='painel'>Lorem ipsum dolor sit amet.</div>
    <div class='disparador'></div>
</div>

<div class='container'>
    <div class='painel'>Lorem ipsum dolor sit amet.</div>
    <div class='disparador'></div>
</div>

CSS:

.container {
    position: relative;
    width:200px;
    height: 350px;
    float: left;
}
.painel {
    display:none;
    width: 100px;
    height: 350px;
    overflow: auto;
    position:absolute;
    top: 0;
    left:0;
}
.disparador {
    width: 200px;
    min-width: 50%;
    height: 350px;
    position:absolute;
    top: 0;
    right:0;
    background-color: red;
}

JSFiddle

    
19.08.2014 / 14:16