JCarouselLite does not set width and left value on div

jCarouselLite does not set width and left values ​​in div. Also in firebug the div and ul are greyed, although the div has:

visibility: visible;

At the same time, the width and height attributes on ul and subsequent li are set to 0. If jCarouselLite does not set these parameters?

Images are uploaded to the DOM - but not displayed.

+3
source share
4 answers

This is caused by the CSS rule that set the containing <div>- display:none.

As soon as I delete it, the plugin calculated the values ​​correctly.

+3
source

But what to do when the elements on your page need to be hidden at startup?

, , , , .

<script type="text/javascript"> 
    $('#myElement').animate({left: '-=5000px'}, 0);
</script>

jQuery google maps.

, , ... , , .

+1

"display: none", jQuery slideToggle . slideToggle jCarouselLite. , :

$("#Gallery").slideToggle("slow", function () {
    if (!carouselLoaded) {
        $(".carousel").jCarouselLite({
            btnNext: ".next",
            btnPrev: ".prev",
            circular: true,
            visible: 1
        });
        carouselLoaded = true;
    }
});

jCarouselLite .

+1

In the jquery.jcarousellite.js file, change the value div.css(sizeCss, divSize+"px");to div.css(sizeCss, "100%");or any pixel that you want to set.
In addition, you can set the number you want to show using the visible: 5
Ex configuration :

        <script type="text/javascript">
            $(function() {
                $(".auto .carousel").jCarouselLite({
                    auto: 1000,
                    speed: 4000,
                    visible: 5

                });
            });
        </script>
+1
source

Source: https://habr.com/ru/post/1733086/


All Articles