私はReveal.initialize()
の反対側/反対側を探しています。プログラムでreveal.jsプレゼンテーションを終了する方法。reveal.jsプレゼンテーションを「終了」できますか?
2
A
答えて
0
プレゼンテーションを開始する前に、DOMツリーのコピー(1)を作成してから、必要に応じて復元することができます(2)。
// (1) create DOM copy
window.saved = document.body.cloneNode(true);
Reveal.initialize({
// initialisation parameters
});
// (2) restore DOM to previous state
document.body.parentNode.replaceChild(window.saved, document.body)
プレゼンテーションを停止していてエラーが発生していません。唯一の問題は、プレゼンテーションをもう一度開始するために余分なことをする必要があることです。
4
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コンテナを非表示にすることはできませんか? – developius