ContentBlock

ContentBlock

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

Source:
Parameters:
NameTypeDescription
elementHTMLElement

DOM element for component instantiation and scope

optionsObject
Properties
NameTypeDescription
attachClickListenerBoolean

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:
NameTypeDescription
elementHTMLElement
selectorstring

init()

Description:
  • Initialise component.

Source:

linkTo()

Description:
  • Redirect the user to the desired url.

Source:

(static) autoInit(root) → {ContentBlock}

Source:
Parameters:
NameTypeDescription
rootHTMLElement

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:
NameTypeDescription
hrefString