Skip to content
Snippets Groups Projects
Commit 62f7e6ce authored by William Warriner's avatar William Warriner
Browse files

add rstackfix plugin

parent 42cf0918
No related branches found
No related tags found
No related merge requests found
window.rStackFix = function () {
return {
id: "rStackFix",
init: function (deck) {
console.log("Custom plugin initialized!");
// Automatically load the initial fragment on a slide if the fragment
// has been defined with the 'preload' class
deck.on("slidechanged", function (event) {
console.log("slidechanged");
if (
event.currentSlide.querySelectorAll(
'.preload[data-fragment-index="0"]'
).length > 0
) {
deck.nextFragment();
}
});
// If the initial fragment on a slide has been defined with a 'preload' class
// then transition to the previous slide if the fragment is hidden
deck.on("fragmenthidden", function (event) {
console.log("fragmenthidden");
if (
event.fragment.hasAttribute("data-fragment-index") &&
event.fragment.classList.contains("preload")
) {
if (event.fragment.attributes["data-fragment-index"].value == "0") {
deck.prev();
}
}
});
},
};
};
name: rStackFix
script: [plugin.js]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment