StickyAd

Sticky header ad.

Source:
Example
<section class="l-headerAd">
		<div class="l-headerAd__container">
			<div class="c-ad c-ad--728x90">
				<div class="c-ad__unit"></div>
	 		</div>
			<div class="l-headerAd__countdown">
				<span class="l-headerAd__message"></span>
				<span class="l-headerAd__close">Close X</span>
	 		</div>
		</div>
</section>

Methods

(inner) broadcast(event)

Source:

Fire custom event to window object

Parameters:
Name Type Description
event

name of custom event

(inner) init()

Source:

Search for any sticky ad elements and bind click and ad complete events

(inner) intersectionCallback()

Source:

When ad is not visible, make it sticky unless it has already been visible for more than ${visibleFor} number of seconds

(inner) slideOut()

Source:

Slide out sticky element smoothly and return it to original position

(inner) startCountdown()

Source:

Start updating sticky ad countdown per 1 second.

(inner) stick()

Source:

Make element sticky and create a clone for observing its viewability

(inner) stopCountdown()

Source:

Clear interval for countdown and hide the countdown message.

(inner) unstick($forGood)

Source:

Unstick element and stop observing viewability of unsticking for good

Parameters:
Name Type Description
$forGood Boolean

when set to true, slide out sticky element and stop observing

(inner) updateCountdown()

Source:

Update countdown and display message indicating number second(s) left.