##### 16.9.8.1 Creating drop-down hotspots with DITA2Go controls and macros

The following settings use DITA2Go format property DropDownLink and two macros to handle open/close actions for dedicated drop-down paragraph format DropPara.

    [HTMLParaStyles]
    DropPara = DropDownLink CodeBefore CodeAfter

    [ParaStyleCodeBefore]
    ; At the start of any of the following paragraphs,
    ; close any open drop-down blocks:
    DropPara = <$DropDownBlockClose>
    ; List any other paragraphs that should end a drop-down block:
    H1 = <$DropDownBlockClose>
    H2 = <$DropDownBlockClose>
    H3 = <$DropDownBlockClose>
    H4 = <$DropDownBlockClose>
    H5 = <$DropDownBlockClose>

    [ParaStyleCodeAfter]
    DropPara = <$DropDownBlockOpen>

    [Inserts]
    ; At end of body, close any open drop-down blocks:
    Bottom = <$DropDownBlockClose>

    [DropDownBlockOpen]
    ; After DropPara, insert javascript to open a new drop-down block,
    ; and set a flag to signify that the block is open. The javascript
    ; includes a counter to identify the drop-down section:
    <$$DropDownCount++>
    ; Strip leading zeroes:
    <div class="dropdown" id="drop<$$DropDownCount as %0.1d>"
    style="display:none;"
    onclick="noSection('drop<$$DropDownCount as %0.1d>')">
    <$$Flag_DropDownBlockOpen = 1>

    [DropDownBlockClose]
    ; Before DropPara or H1 through H5 or </body>,
    ; check a flag to see if a drop-down block is open;
    ; if so, close the drop-down block and clear the flag:
    <$_if ($$Flag_DropDownBlockOpen)>
    </div>
    <$$Flag_DropDownBlockOpen = 0>
    <$_endif>

    [MacroVariables]
    ; Put any macro definition sections before this section.
    Flag_DropDownBlockOpen = 0
    DropDownCount = 0

Previous Topic: 16.9.8 Emulating Web Works Publisher drop-down hotspots

Next Topic: 16.9.8.2 Creating drop-down hotspots with DITA2Go macros only

Parent Topic: 16.9.8 Emulating Web Works Publisher drop-down hotspots

Sibling Topics:

16.9.8.2 Creating drop-down hotspots with DITA2Go macros only