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

Lory Slider: Empty Slides and Sorting of Slides #8

Open
rastaprime20 opened this issue Dec 26, 2019 · 2 comments
Open

Lory Slider: Empty Slides and Sorting of Slides #8

rastaprime20 opened this issue Dec 26, 2019 · 2 comments

Comments

@rastaprime20
Copy link

rastaprime20 commented Dec 26, 2019

Hi,

Hope you are doing well.

As I am working with your Lory Slider, I'm just wondering do you have any workaround, to detect whether there's an empty slide inside the slider? Then once we have detected that the slider has an empty slide content in it, we have to delete the empty slide. If it is possible to give me a guideline or snippet that I can work on, that would be great help.

And one more thing, if there's a way to reorder or sort the slides?

Regards,
Tyrone

@rastaprime20
Copy link
Author

Hi,

I would like to know if this is possible?

Regards

@Adham380
Copy link

Adham380 commented Aug 5, 2022

Hi,

Hope you are doing well.

As I am working with your Lory Slider, I'm just wondering do you have any workaround, to detect whether there's an empty slide inside the slider? Then once we have detected that the slider has an empty slide content in it, we have to delete the empty slide. If it is possible to give me a guideline or snippet that I can work on, that would be great help.

And one more thing, if there's a way to reorder or sort the slides?

Regards, Tyrone

I did it myself.

` function slideRemover() {

                                        if (myElem.length < 1) {
                                            var slides = document.getElementsByClassName("gjs-lory-slide")

                                            for (let i = 0; i < slides.length; i++) {
                                                var checkIfFinished = 0
                                                if ((slides.length - checkIfFinished) == 0) {
                                                    break;
                                                }

                                                if (slides[i].children.length < 1) {


                                                    slides[i].remove();
                                                    slideRemover();
                                                } else {
                                                    checkIfFinished = checkIfFinished + 1
                                                }
                                            }
                                        }


                                    }`

It basically checks if a slide doesn't have a child and if yes, to delete them on the exported page. This is all done inside the script function of grapesjs-lory-slider.min.js and there you call this function. You might have to unminify the file to edit it.

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