ContentBlock

ContentBlock

new ContentBlock(element, options, (String), (String), (Integer))

Source:
Parameters:
Name Type Description
element HTMLElement

DOM element for component instantiation and scope

options Object
Properties
Name Type Description
attachClickListener Boolean

Whether or not to bind click events

(String)

options.targetSelector The selector of the element where to attach the click listener

(String)

options.titleSelector The selector of the element containing the link

(Integer)

options.maxIterations Maximum number of ancestors to look for the element

Classes

ContentBlock

Methods

destroy()

Description:
  • Destroy component.

Source:

findElementInCommonAncestor(element, selector)

Description:
  • Find an element in a common ancestor.

Source:
Parameters:
Name Type Description
element HTMLElement
selector string

init()

Description:
  • Initialise component.

Source:

linkTo()

Description:
  • Redirect the user to the desired url.

Source:

(static) autoInit(root) → {ContentBlock}

Source:
Parameters:
Name Type Description
root HTMLElement

DOM element for component instantiation and scope

Returns:

An instance of ContentBlock.

Type
ContentBlock

(static) convertToFullURL(href)

Description:
  • Convert a path to a full url.

Source:
Parameters:
Name Type Description
href String