Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// Some code via
// The Function below tests to see if the DFP enabler has been loaded.
// The DFP Enabler is embedded in the <head> of this document.
// You can edit the contents of the <head>…</head> of your exported .html file by clicking on 'Edit HTML Head' in the Document Inspector.
// If it has loaded, then the main timeline is 'continued'
// This should happen fairly quickly.
// If true, start function. If false, listen for INIT.
window.onload = function() {
if (Enabler.isInitialized()) {
} else {
function enablerInitHandler() {
// Start ad, initialize animation,
// load in your image assets, call Enabler methods,
// and/or include other Studio modules.
// Also, you can start the Polite Load
// On the main timeline, the Timeline has a 'pause' action, so this resumes it
hypeDocument.continueTimelineNamed('Main Timeline', hypeDocument.kDirectionForward);
// If true, start function. If false, listen for PAGE_LOADED.
// Insert this code inside your enablerInitHandler function
if (Enabler.isPageLoaded()) {
} else {
//The following code out of the enablerInitHandler function:
function pageLoadedHandler() {
// Load in additional assets or add animation/video
//hypeDocument.continueTimelineNamed('Main Timeline', hypeDocument.kDirectionForward);
// The Code below starts your animation only if it is visible. Again, run a 'continue timeline' action in line 74
// To use this option.
// If true, start function. If false, listen for VISIBLE.
// So your pageLoadedHandler function will look like the following:
function pageLoadedHandler() {
if (Enabler.isVisible()) {
} else {
function adVisibilityHandler() {
// Page has loaded and ad is visible:
hypeDocument.continueTimelineNamed('Main Timeline', hypeDocument.kDirectionForward);

This comment has been minimized.

Copy link
Owner Author

@themorgantown themorgantown commented Aug 3, 2016

For more info on this snippet, visit:

Suggestions for improvement appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment