Zeus
Zeus

Reputation: 3357

horizontal slide with 100% width with jcarousellite

I am using jcarousellite control to provide carousel effect on my images via next and prev button.

<button class="prev"><<</button>
<button class="next">>></button>

<div class="anyClass" style="background-color:Red;" >

    <ul style="width:100%">
        <li style="width:100%" ><div style="background-color:Green; width:100%; text-align:center; margin:0 auto;" ><img src="Untitled-1.jpg" /></div></li>
        <li style="width:100%"><div style="background-color:yellow; width:100%; text-align:center; margin:0 auto;" ><img src="Untitled-2.jpg" /></div></li>
        <li style="width:100%"><div style="background-color:Green; width:100%; text-align:center; margin:0 auto;" ><img src="Untitled-1.jpg" /></div></li>
        <li style="width:100%"><div style="background-color:yellow; width:100%; text-align:center; margin:0 auto;" ><img src="Untitled-2.jpg" /></div></li>            
    </ul>
</div>

I want them to expant as far as the width of the browser. Width : 100%. This is not working for some reason.

I guess the question would be how do I have 100% width of <li> so that it can expand till the end of the screen.

=========================

update

if i set width:105% on anyclass then it is giving full width. However once I go on bigger screen it again gives issues...please help

Upvotes: 1

Views: 3310

Answers (4)

Linto Thomas
Linto Thomas

Reputation: 1

$('.jcarousel')
    .on('jcarousel:create jcarousel:reload', function() {
        var element = $(this),
            width = element.innerWidth();

        if (width > 900) {
            width = width / 1;
        } else if (width > 600) {
            width = width / 1;
        }

        element.jcarousel('items').css('width', width + 'px');
    })
        $('.jcarousel').jcarousel();

Upvotes: 0

Zeus
Zeus

Reputation: 3357

I ended up using another plugin

Upvotes: 1

Zeus
Zeus

Reputation: 3357

Actually I had to add li and ul with 100% with and no paddin no margin...that did the trick

Upvotes: 0

i am not sure it will work, but try

.body {
    width: 100%;
}

in your CSS

Upvotes: 1

Related Questions