Anand Jaju
Anand Jaju

Reputation: 458

How to make a image slider responsive?

I have used a plugin for image slider. Its working fine but it is not becoming responsive, means when I decrease the size of window, it is not going to the slider doesn't changes its size. Following is screenshot:

enter image description here

Following is code:

<div id="main-content">
    <br/>
    <div id="slideshow">
        <ul class="slides">
            <li class="sl"><img class="ss" src="image/a.png" width="82%" alt="Splash Screen" /></li>
            <li class="sl"><img class="ss" src="image/b.png" width="82%" alt="Select Route" /></li>
            <li class="sl"><img class="ss" src="image/c.png" width="82%" alt="New Schedule" /></li>
            <li class="sl"><img class="ss" src="image/d.png" width="82%" alt="Created Routes" /></li>
            <li class="sl"><img class="ss" src="image/e.png" width="82%" alt="CR"/></li>
        </ul>
        <span class="arrow next"></span>
        <span class="arrow previous"></span>
    </div>
</div>

Following is css:

/*main content*/
#main-content {
    margin-left:auto;
    margin-right:auto;
    margin-top:35px;
    max-width:900px;
    border-top-left-radius:48px;
    border-top-right-radius:48px;
    border-bottom-left-radius:48px;
    border-bottom-right-radius:48px;
    padding-bottom:20px;
    min-height:1100px;
    background:url(res/back-img.png) repeat;
}

#slideshow{
    background:url(res/iphone_small.png) no-repeat;
    height:512px;
    /*margin:auto 30px;*/
    margin:40px 28px auto;
    position:relative;
}

#slideshow ul{
    height:55%;
    list-style:none outside none;
    overflow:hidden;
    position:absolute;
    top:12%;
    width:20%;
}

#slideshow li{
    position:absolute;
    display:none;
    z-index:10;
}

#slideshow li:first-child{
    display:block;
    z-index:1000;
}

#slideshow .slideActive{
    z-index:1000;
}

#slideshow canvas{
    display:none;
    position:absolute;
    z-index:100;
}

#slideshow .arrow{
    height:12.5%;
    width:5.1%;
    position:absolute;
    background:url('res/arrows.png') no-repeat;
    top:50%;
    margin-top:-55px;
    cursor:pointer;
    z-index:5000;
    margin-left:28.5%;
    margin-right:98%;
}

#slideshow .previous{ background-position:right top;right:0;}
#slideshow .previous:hover{ background-position:right bottom;}

#slideshow .next{ background-position:left top;left:0;}
#slideshow .next:hover{ background-position:left bottom;}

So how can I make it responsive. I did Google very much, I am not getting how to it. Please can any one help me to solve this issue.. Thanks in advance..

Upvotes: 4

Views: 29812

Answers (3)

Albin Shaji
Albin Shaji

Reputation: 61

#slideshow{
max-width:30em;
height:30em;
}

Try this change your measurements into em instead of px worked for me.

Upvotes: 1

sajid
sajid

Reputation: 1

Make the slider width in % and make it 100%, also install cycle2 plugin. it will work then.

Upvotes: 0

Hovhannes Sargsyan
Hovhannes Sargsyan

Reputation: 1083

remove 82% and set

img{
   max-width:100%;
   height:auto;

}

Upvotes: 0

Related Questions