Template:FAQItem: Difference between revisions

From Bose Portable PA Encyclopedia
Jump to navigation Jump to search
mNo edit summary
Tag: Reverted
m (ST moved page Template:FAQItemL to Template:FAQItem without leaving a redirect: new version with link)
 
(One intermediate revision by the same user not shown)
Line 44: Line 44:


<!-- Generate a stable anchor ID from the question text -->
<!-- Generate a stable anchor ID from the question text -->
<!-- Anchor -->
<span id="{{anchorencode:{{{question}}}}}"></span>
<span id="{{anchorencode:{{{question}}}}}"></span>


<!-- FAQ block -->
<html>
<details class="faq-item">
<details class="faq-item">
 
<summary style="font-weight: bold; font-size:larger;"></html>{{{question}}}<html></summary>
<summary style="font-weight: bold; font-size:larger;">
</html>
{{{question}}}
</summary>


<div style="margin:0.5em 0 1em 0; font-size:smaller; opacity:0.7;">
<div style="margin:0.5em 0 1em 0; font-size:smaller; opacity:0.7;">
    <a href="#" class="copy-link" data-frag="{{anchorencode:{{{question}}}}}">
[[{{FULLPAGENAME}}#{{anchorencode:{{{question}}}}}|Link to this question]]
        Copy link to this question
    </a>
</div>
</div>


<html>
<blockquote class="faq-answer">
<blockquote class="faq-answer">
{{{answer}}}
</html>{{{answer}}}<html>
</blockquote>
</blockquote>
</details>
</details>
 
</html>
<!-- Script (allowed in wikitext) -->
<script>
document.addEventListener('DOMContentLoaded', function() {
    document.querySelectorAll('.copy-link').forEach(function(link) {
        link.addEventListener('click', function(e) {
            e.preventDefault();
            const frag = this.getAttribute('data-frag');
            const url = window.location.origin + window.location.pathname + '#' + frag;
 
            navigator.clipboard.writeText(url).then(() => {
                const original = this.innerText;
                this.innerText = 'Copied!';
                setTimeout(() => { this.innerText = original; }, 1500);
            });
        });
    });
});
</script>

Latest revision as of 01:10, 27 February 2026

Creates a FAQ item with collapsible details and a permalink

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Questionquestion

The Question

Stringrequired
Answeranswer

The Answer to the question

Stringrequired

FAQItem usage

  1. Copy text between the horizontal lines for each Question with Answer
  2. Put the Question after | question =
  3. Put the Answer after | answer =

{{FAQItem

| question =

| answer =

}}


The FAQItem will render as it appears below this line.



{{{question}}}

{{{answer}}}