31.07.2013 Views

Build Guide

Build Guide

Build Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

.NOTE:. Enabler.getUrl() is required when loading in an image within Studio to make sure that studio can locate the file properly when adserved.<br />

For more information check out our help centre .here.<br />

.>. Instantiation and Event Handling<br />

Instantiating the component is straightforward and is done as follows:<br />

var mySwipe4More = new studio.innovation.components.SwipeForMore(config);<br />

.NOTE:. This is again done for the downloadable demo from this document within the s4m_demo.js file.<br />

Immediately following instantiation, you can set up listeners and callback for the SWIPE_OPEN and SWIPE_CLOSE<br />

custom events. In place of the console.log, it is typical to invoke the Studio HTML5 Enabler.<br />

mySwipe4More.addEventListener(studio.innovation.components.SwipeForMore.SWIPE_OPEN, function() {<br />

console.log('open');<br />

Enabler.counter("HTML5 Counter - Open Swipe For More Container");<br />

}, false);<br />

mySwipe4More.addEventListener(studio.innovation.components.SwipeForMore.SWIPE_CLOSE,<br />

function() {<br />

console.log('close');<br />

Enabler.counter("HTML5 Counter - Close Swipe For More Container");<br />

}, false);<br />

.NOTE:. The Enabler.counter() call is a custom Rich Media counter which will appear within the Rich Media report for your creative, allowing you<br />

to easily see which of your images was viewed the most. For more information on setting up Rich Media Counters see our help centre .here.<br />

Finally, to actually show the component you must call the render method and supply the parent container. The<br />

parent container can be any valid element.<br />

mySwipe4More.render(document.getElementById('swipe-container'));<br />

IMPORTANT: This component relies on the latest CS3 effects (specifically, CSS transitions and CSS transforms).<br />

The component uses Modernizr to sniff out these capabilities, and if it does not detect them the swipe pane and<br />

tab will NOT load. The recommended strategy is to include a static image within the parent DIV container that will<br />

contain Swipe For More.<br />

Example:<br />

<br />

/* The content below serves as the backdrop to your ad, over which the swipe pane<br />

* gets placed. In this example, a static JPG is the backdrop and will be shown<br />

* regardless of whether the user’s device can support Swipe For More.<br />

*/<br />

<br />

<br />

Other API Methods.<br />

.>. Programmatically Opening and Closing of the SwipeForMore Object.<br />

To open the main content area of the SwipeForMoreObject:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!