Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How I can add slides dynamicaly #3342

Closed
MuhammadSaim opened this issue Dec 22, 2022 · 1 comment
Closed

How I can add slides dynamicaly #3342

MuhammadSaim opened this issue Dec 22, 2022 · 1 comment

Comments

@MuhammadSaim
Copy link

image

import Reveal from 'reveal.js';
import Appearance from 'reveal.js-appearance/plugin/appearance/appearance.esm';

let slideshow = new Reveal()
slideshow.initialize({
    width: "100%",
    height:"100%",
    autoSlide: 5000,
    controls: false,
    progress: false,
    loop: true,
    appearance: {
        hideagain: true,
        delay: 300,
        appearevent: 'slidetransitionend',
        autoappear: false,
        autoelements: false,
        csspath: '',
        animatecsspath: {
            link : 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css',
            compat : 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.0.0/animate.compat.css',
        },
        compatibility: false,
        compatibilitybaseclass: 'animated'
    },
    plugins: [Appearance]
});


setInterval(() => {

    let url = $("#slides-status").data('url');

    $.ajax({
       url: url,
        success: (data) => {
            if(data.data.length > 0){
                data.data.map((d) => {
                    slideshow.add(d);
                });
                slideshow.sync();
            }
        }
    });


}, 5000);
@Martinomagnifico
Copy link
Collaborator

When you use Markdown, you can easily import external Markdown files. That is built into the Reveal.js Markdown plugin.

For HTML, there is a (third-party) plugin that allows you to load slides dynamically: https://github.com/janschoepke/reveal_external

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants