我正在寻找 Reveal.initialize()
的对应项/相反项。一种以编程方式结束 Reveal.js 演示的方法。
最佳答案
Reveal.js 没有实现以编程方式结束演示的方法。 Here is the list of methods available .
如果您正在寻找销毁 Reveal.js 的实例,除非 Reveal.js 团队实现它,否则这是不可能的。你可以做的是,你可以删除初始化了 Reveal 事件的 DOM 元素。
下面是您可以销毁 Reveal.js 演示文稿的所有/任何实例的代码。
Element.prototype.remove = function() {
this.parentElement.removeChild(this);
}
NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
for(var i = this.length - 1; i >= 0; i--) {
if(this[i] && this[i].parentElement) {
this[i].parentElement.removeChild(this[i]);
}
}
}
document.querySelectorAll('.reveal').remove();
//To remove all containers created by Math Plugin
var mathPluginContainers = document.querySelectorAll("[id^='MathJax']");
mathPluginContainers = Array.prototype.slice.call(mathPluginContainers);
var mathPluginParents = mathPluginContainers.map(function(container) {
return container.parentElement;
});
mathPluginParents.forEach(function (container, index) {
if (container.tagName === 'DIV') {
container.remove();
} else {
container.removeChild(mathPluginContainers[index]);
}
});
关于reveal.js - 你能 "end"一份 Reveal.js 演示文稿吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36612523/