The Widget JavaScript API allow you to utilize specific functions and attributes available for the widget and the banner itself.

Please note

Methods and Properties should generally speaking be used within a BannerFlow EventListener to ensure that they are available.
 All Methods and Properties are available on BannerFlow.INIT.

Events

When your banner is loaded on a website the widget will be an IFRAME in the banner. When the widget is loaded, an object called “BannerFlow” is accessible and will help you listen to various banner events and information.

Examples

BannerFlow.addEventListener(BannerFlow.INIT, function(){
    console.log("Everything is initiated")
})
BannerFlow.addEventListener(BannerFlow.START_ANIMATION, function(){
    console.log("Widget is now active in the banner timeline")
})

Methods

There's a set of pre-defined methods which either returns values or executes an event.
 Some of methods are also available as simple properties, see further down below.

Examples

BannerFlow.addEventListener(BannerFlow.RESIZE, function(){
    var w = BannerFlow.getWidth();
    var h = BannerFlow.getHeight();
})

Properties

Properties just returns a value

Examples

BannerFlow.addEventListener(BannerFlow.SETTINGS_CHANGED, function(){
    var element = document.getElementById("mydiv");
    element.style.fontSize = BannerFlow.settings.textSize;
    element.style.color = BannerFlow.settings.textColor;
})
Did this answer your question?