A
A
Antono__882021-02-19 16:19:12
JavaScript
Antono__88, 2021-02-19 16:19:12

How to create carousel with preloader and fake API?

Hello!

please tell me how you can simulate loading from the REST API as in the picture

602fb6092e233488231841.png

, I basically created a carousel, but I don’t understand how to simulate loading other cards.

when you click on the button, I want a fake loading with some kind of loader to take place and then the next slide

code is shown below, I redid it a bit, and here the slider is of course not working, since the second day of testing I spend
pictures, I take random ones from the Internet

, here is my code

<body>
    <h1>Carousel</h1>
    <div id="my-carousel"></div>
    <script>
        var option1 = {
            container: "my-carousel",
            title: "Fresh and just upload content",
            subtitle: "Lorem ipsum",
            fetchCards: function(chunkSize) {
                // здесь пытаюсь сделать так чтобы функция chunksize взращала обект с карточками
                //каторая будет показана в каруселе

                // вот так я хочу разделить каждую карточку
                return {
                    image: "https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg",
                    type: "learning",
                    duration: 3600,
                    title: "welcome",
                    cardinality: "single"
                };
            }
        }

        var carousel1 = new Carousel(options1);
    </script>
</body>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Fenix957, 2021-03-10
@Fenix957

The question was
How to make placeholder/preloader content blocks on page load?
And here is the solution
https://github.com/zalog/placeholder-loading

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question