Options
All
  • Public
  • Public/Protected
  • All
Menu

Tab

Example

<section id="tab">
  <nav>
    <a>tab 1</a>
    <a>tab 2</a>
    <a>tab 3</a>
  </nav>
  <article>content 1</article>
  <article>content 2</article>
  <article>content 3</article>
</section>
const tab = new Tab(document.getElementById('tab'));

tab.on('switch', ({title, content, current, previous}) => {})

Hierarchy

  • EventEmitter
    • Tab

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

host

host: HTMLElement

container element

Methods

destroy

  • destroy(): void
  • Destroy tab instance, remove all listeners

    Returns void

off

  • off(type: string, handler: function): void
  • Remove an event handler for the given type.

    Parameters

    • type: string

      Type of event to unregister handler from, or "*"

    • handler: function

      Handler function to remove

        • (event?: any): void
        • Parameters

          • Optional event: any

          Returns void

    Returns void

on

  • on(type: string, handler: function): void
  • Register an event handler for the given type.

    Parameters

    • type: string

      Type of event to listen for, or "*" for all events

    • handler: function

      Function to call in response to given event

        • (event?: any): void
        • Parameters

          • Optional event: any

          Returns void

    Returns void

refresh

  • refresh(index: number): void
  • Refresh tab list, and switch to a specified index

    Parameters

    • index: number

    Returns void

switch

  • switch(index: number): void
  • Switch to a specified index

    Parameters

    • index: number

    Returns void

Static config

Generated using TypeDoc