horizontal div with pagination one by one

Asked

Viewed 119 times

1

Good afternoon fellow programmers, I have the following question:

I have a div (#grid) with several blocks (.item) floating side by side, but only the first 3 are being shown and the rest of the blocks are hidden. I need when clicked on button > next it shows the next block one by one and hide the first.

HTML:

<div id="grid">
<div class="prev">Voltar</div>

<div class="list">
    <div class="item">
        <a href="#"><img src=""></a>
    </div>
    <div class="item">
        <a href="#"><img src=""></a>
    </div>
    <div class="item">
        <a href="#"><img src=""></a>
    </div>
    <div class="item">
        <a href="#"><img src=""></a>
    </div>
    <div class="item">
        <a href="#"><img src=""></a>
    </div>
    <div class="item">
        <a href="#"><img src=""></a>
    </div>
</div>

<div class="next">Próximo</div>

CSS:

#content #grid{
width: 100%;
max-height: 300px;
}
#content #grid .item{
    width: 32%;
    height: 100%;
    float: left;
    border: 5px solid #dddddd;
    overflow: hidden;
    border-radius: 10px;
    margin-left: 2%;
    font-size: 0;
}
#content #grid .item:first-child{margin-left: 0 !important}
  • Already using some javascript code ? If yes ask the question to help in your doubt.

  • Experienced this example, by changing the amount of columns of each div, will work perfectly for your need. https://codepen.io/MhSami/pen/zNBMbj

  • try this one too, html, css, javascript in source code http://kithomepage.com/sos/div-slide.htm

  • @Eliseub. That’s just what I need, but I don’t want to use any frakework but jQuery. Any idea how to do this?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.