|
| 1 | +.. include:: /Includes.rst.txt |
| 2 | +.. index:: ! Accordion |
| 3 | +.. _accordion: |
| 4 | + |
| 5 | +========= |
| 6 | +Accordion |
| 7 | +========= |
| 8 | + |
| 9 | +.. accordion:: |
| 10 | + :name: accordionExample |
| 11 | + |
| 12 | + .. accordion-item:: Accordion Item #1 |
| 13 | + :name: headingOne |
| 14 | + :header-level: 2 |
| 15 | + :show: |
| 16 | + |
| 17 | + **This is the first item's accordion body.** It is shown by default, until the collapse plugin adds the |
| 18 | + appropriate classes that we use to style each element. These classes control the overall appearance, |
| 19 | + as well as the showing and hiding via CSS transitions. |
| 20 | + |
| 21 | + You can modify any of this with custom CSS |
| 22 | + or overriding our default variables. It's also worth noting that just about any HTML can go within |
| 23 | + the `.accordion-body`, though the transition does limit overflow. |
| 24 | + |
| 25 | + .. accordion-item:: Accordion Item #2 |
| 26 | + :name: headingTwo |
| 27 | + :header-level: 2 |
| 28 | + |
| 29 | + Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. |
| 30 | + This is the second item's accordion body. Let's imagine this being filled with some actual content. |
| 31 | + |
| 32 | + .. accordion-item:: Accordion Item #3 |
| 33 | + :name: headingThree |
| 34 | + :header-level: 2 |
| 35 | + |
| 36 | + Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. |
| 37 | + This is the third item's accordion body. Nothing more exciting happening here in terms of content, but |
| 38 | + just filling up the space to make it look, |
| 39 | + at least at first glance, a bit more representative of how this would look in a real-world application. |
| 40 | + |
| 41 | +Accordion all closed |
| 42 | +==================== |
| 43 | + |
| 44 | +.. accordion:: |
| 45 | + :name: accordionExample2 |
| 46 | + |
| 47 | + .. accordion-item:: Accordion Item #1 |
| 48 | + :name: headingOne2 |
| 49 | + :header-level: 3 |
| 50 | + |
| 51 | + Placeholder content for this accordion |
| 52 | + |
| 53 | + .. accordion-item:: Accordion Item #2 |
| 54 | + :name: headingTwo2 |
| 55 | + :header-level: 3 |
| 56 | + |
| 57 | + Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. |
| 58 | + This is the second item's accordion body. Let's imagine this being filled with some actual content. |
| 59 | + |
| 60 | + .. accordion-item:: Accordion Item #3 |
| 61 | + :name: headingThree2 |
| 62 | + :header-level: 3 |
| 63 | + |
| 64 | + Let's imagine this being filled with some actual content. |
| 65 | + |
| 66 | + |
| 67 | +Accordion with complex content |
| 68 | +============================== |
| 69 | + |
| 70 | +.. accordion:: |
| 71 | + :name: accordionExample3 |
| 72 | + |
| 73 | + .. accordion-item:: Accordion Item #1 |
| 74 | + :name: headingOne3 |
| 75 | + :header-level: 3 |
| 76 | + |
| 77 | + .. tabs:: |
| 78 | + |
| 79 | + .. tab:: Apples |
| 80 | + |
| 81 | + Apples are green, or sometimes red. |
| 82 | + |
| 83 | + .. tab:: Pears |
| 84 | + |
| 85 | + Pears are green. |
| 86 | + |
| 87 | + .. tab:: Oranges |
| 88 | + |
| 89 | + Oranges are orange. |
| 90 | + |
| 91 | + .. accordion-item:: Accordion Item #2 |
| 92 | + :name: headingTwo3 |
| 93 | + :header-level: 3 |
| 94 | + :show: |
| 95 | + |
| 96 | + .. code-block:: javascript |
| 97 | +
|
| 98 | + var makeNoise = function() { |
| 99 | + console.log("Pling!"); |
| 100 | + }; |
| 101 | +
|
| 102 | + makeNoise(); |
| 103 | + // → Pling! |
| 104 | +
|
| 105 | + var power = function(base, exponent) { |
| 106 | + var result = 1; |
| 107 | + for (var count = 0; count < exponent; count++) |
| 108 | + result *= base; |
| 109 | + return result; |
| 110 | + }; |
| 111 | +
|
| 112 | + console.log(power(2, 10)); |
| 113 | + // → 1024 |
| 114 | +
|
| 115 | +
|
| 116 | + .. accordion-item:: Accordion Item #3 |
| 117 | + :name: headingThree3 |
| 118 | + :header-level: 3 |
| 119 | + |
| 120 | + .. image:: ../images/q150_ffffff.png |
| 121 | + :alt: Image with background color #ffffff |
| 122 | + :class: with-border with-shadow |
0 commit comments