2016-09-13 56 views
0

我發現了幾個資源,據說可以展示如何在Google協作平臺中製作可摺疊列表,但似乎沒有任何工作。我嘗試在網站中插入HTML框,以及修改HTML源代碼。 Google Sites似乎只是剝離了任何JavaScript。有沒有辦法解決這個問題,谷歌是否有一個功能來實現這個功能(這不是我的目的不適合的列表模板)?Google網站可摺疊列表

這裏是我試過的資源:

tutorials.seowebpower.com/google-sites-advanced/collapsible-table

sites.cognitivescience.co/knowledgebase/resources/using-google-網站/富創建信息 - - gsites的頁面

How to create expandable FAQ page in HTML?

support.google.com/sites/search?q=list

回答

1

我擺弄了鏈接問題中的其中一個答案,它現在似乎適用於我,提供了兩個隱藏答案的問題,可以隱藏/顯示,您應該能夠在隱藏/顯示時將其調整爲摺疊列表功能在那裏。

這在htmlbox

<script> 
function toggleElement(myid) 
{ 
    if(document.getElementById(myid).style.display == 'none') 
    { 
     document.getElementById(myid).style.display = 'block'; 
    } 
    else 
    { 
     document.getElementById(myid).style.display = 'none'; 
    } 
} 
</script> 

<hr> 
<button id="q1">Is this question one?</button> 

<div id="a1" style="display:none"> 
This is the first answer. 
</div> 
<script> 
document.getElementById('q1').onclick=function(event) {toggleElement("a1"); }; 
</script> 

<hr> 

<button id="q2">Is this question two?</button> 

<div id="a2" style="display:none"> 
This is the second answer. 
</div> 
<script> 
document.getElementById('q2').onclick=function(event) {toggleElement("a2"); }; 
</script> 

<hr> 

看到它的行動在

https://sites.google.com/site/dpcarlisle/fold

(首次點擊需要永遠的東西加載了這裏,不知道谷歌的網站允許足夠的JavaScript來預裝東西,但第一次使用後,它按預期工作)

+0

謝謝,大衛!我應該可以用這個工作。我很感激。 – Stalp