Search code examples
jqueryhtmlwidthcycle

How to set 100% div width in jquery cycle plugin


i have problem.. I must set width of slide div to 100%, max width of the "sklo" div.. See my codes below:

$(function () {
$('#sklo').cycle({ 
    fx:     'scrollHorz', 
    speed:  1000, 
    timeout: 0,
    slideExpr: '.slide',
    slideResize: 1
        }); 
});

And table

<table>
 <tr>
  <td class="container">

<div id="content">

<div id="sklo">
<div class="slide">Text content 1</div>
<div class="slide">Text content 2</div>
<div class="slide">Text content 3</div>
</div>

</div>

  </td>
 </tr>
</table>

And CSS:

.container {
min-width:800px;
width:100%;
position:relative;
}
#sklo {
display:block;
min-width:675px;
min-height:250px;
width:100% !important;
height:100%;
border-radius:20px;
background-color:red;
}
.slide {
min-width:675px;
min-height:250px;
width:100% !important;
text-align:center;
}

my problem:

text content slider can't be 100% width of the "sklo" ?? How to set 100% of the .slide div? Must be in %, no px!

Please help.


Solution

  • Make your table width to 100% then its content will automatically take 100% width

    <table width="100%">
        <tr>
          <td class="container">
             <div id="content">
               <div id="sklo">
                 <div class="slide">Text content 1</div>
                 <div class="slide">Text content 2</div>
                 <div class="slide">Text content 3</div>
               </div>    
             </div>
          </td>
        </tr>
    </table>