Swipe Gallery. HTML5 Component..2.. swipegallery.css ... - Google
Swipe Gallery. HTML5 Component..2.. swipegallery.css ... - Google
Swipe Gallery. HTML5 Component..2.. swipegallery.css ... - Google
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
.<strong>Swipe</strong> <strong>Gallery</strong>.<br />
<strong>HTML5</strong> <strong>Component</strong>.<br />
Introduction.<br />
.Rich Media <strong>HTML5</strong> Build Guide.<br />
.JULY 2012 .<br />
Mobile devices are heavily constrained for screen real estate. Creative layouts can maximize the space available<br />
to convey your brand message, all while being highly interactive. On phones and tablets, users have grown<br />
accustomed to swiping content naturally in order to reveal additional information. The carousel/gallery metaphor<br />
is a common way to enable users to cycle through a series of media. Combined with touch input, the <strong>Swipe</strong> <strong>Gallery</strong><br />
is an excellent way to show a variety of media to users in a way that is not intrusive. <strong>HTML5</strong> <strong>Swipe</strong> <strong>Gallery</strong> achieves<br />
hardware accelerated, “buttery smooth” animation on modern WebKit-based devices.<br />
A preview of a creative using the <strong>Swipe</strong> <strong>Gallery</strong> <strong>HTML5</strong> component can be found here.
.Build &.<br />
.Delivery.<br />
<strong>Swipe</strong> <strong>Gallery</strong> is a configurable <strong>HTML5</strong> template & component that consists of an horizontal strip of images that is<br />
sequenced in such a way that it allows a user to swipe from one image to the next in a smooth, swiping gesture, and<br />
is supported for both touch and mouse.<br />
.NOTE:. This format is initially supported only on WebKit-based browsers (Android, iOS, desktop Chrome and Safari). For initial deployment it is<br />
recommended that you explicitly target mobile Android and iOS.<br />
Developers can easily configure the gallery images, ad dimensions, and animation speed as the gallery is swiped.<br />
Events are raised when an image is swiped into view so custom events can be reported to gauge user interaction.<br />
At present the <strong>Swipe</strong> <strong>Gallery</strong> has no CTA associated with the component. It is recommended that the ad developer<br />
embed the <strong>Swipe</strong> <strong>Gallery</strong> as part of a broader ad/creative that will feature CTAs elsewhere.<br />
Demo files for this creative can be found .here.<br />
A breakdown of the files and how they work can be found below:<br />
.1.. swipe<strong>Gallery</strong>.html (300x250 inpage)<br />
This is the HTML page which contains the <strong>HTML5</strong> creative itself, it creates and calls the elements which the creative<br />
will pull in and also contains the DoubleClick <strong>HTML5</strong> Enabler.<br />
The Enabler contains all of the tracking calls and functionality which allows this creative to work within the<br />
DoubleClick Studio platform and should be added to the head of your HTML as follows:<br />
<br />
<br />
<br />
.NOTE:. Additional information on setting up <strong>HTML5</strong> creatives within DoubleClick Studio and the use of the Enabler can be found .here.<br />
.NOTE:. The HTML page is fully commented, however if you have any questions or comments about the please reach out to our technical team<br />
via .dclk-drmtechnical@google.com.<br />
<strong>.2.</strong>. <strong>swipegallery</strong>.<strong>css</strong>, <strong>swipegallery</strong>.js, modernizr.js<br />
These are required CSS and JS files which form the basis of the swipe gallery component. They contain all of the<br />
script and functionality of the swipe gallery and as such need to be included within the head of the HTML as follows:<br />
<br />
<br />
<br />
.3.. 1.jpg, 2.jpg, 3.jpg, 4.jpg<br />
These are the images which are pulled into the <strong>Swipe</strong> <strong>Gallery</strong>. Note that you can configure the gallery to have an<br />
arbitrary number of images, though you should balance this with total filesize and download times on mobile<br />
devices.<br />
.4.. swipe.png<br />
This is an image which is displayed within the swipe gallery on first load that makes it clear to a user that the<br />
images can be “swiped”. The image can be turned on or off within the config settings explained further down this<br />
document.<br />
.5.. backup.jpg<br />
This is the backup image for the creative which will display if the creative is viewed by a non <strong>HTML5</strong> compliant<br />
browser. It should be the size of the creative, so in this case 300x250px<br />
.Using the <strong>Component</strong>.<br />
.>. Configuration<br />
The goal of this mobile component is to be as flexible as possible especially around its configuration. In order to set<br />
it up a config object is created in JavaScript (shown below) and then passed to the component.<br />
var config = {<br />
// // Id of container that will hold the component.<br />
adContainerId: 'gallery',<br />
// Image that instructs user that swiping is possible.<br />
swipeInstructionImage: 'swipe.png',<br />
// Images in the swipe gallery. Make sure that the width<br />
// of each image should be the same and should furthermore<br />
// match the container div's width.<br />
images: [{'src': Enabler.getUrl('1.jpg'), 'width': 315, 'height': 197},<br />
{'src': Enabler.getUrl('2.jpg'), 'width': 315, 'height': 197},<br />
{'src': Enabler.getUrl('3.jpg'), 'width': 315, 'height': 197},<br />
{'src': Enabler.getUrl('4.jpg'), 'width': 315, 'height': 197}<br />
],<br />
// Transition duration in milliseconds.<br />
transitionDuration: 300,<br />
zIndexStart: 8000,<br />
// Whether to display the slide the user is on.<br />
showNavigation: false,<br />
// Delay in ms (used to correct an Android animation glitch).<br />
animationSnapDelay: 40<br />
};<br />
.NOTE:. To pull in more images to the swipe gallery simply add extra lines to the images array and the swipe gallery will pull in more images.<br />
Alternatively if you want fewer images, simply remove an image from the array.<br />
.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.
.>. Instantiation and Event Handling<br />
Wait for the Enabler to be initialised:<br />
// Set up our point of entry.<br />
if (Enabler.isInitialized()) {<br />
init();<br />
} else {<br />
Enabler.addEventListener(studio.events.StudioEvent.INIT, init);<br />
}<br />
Instantiating the component is straightforward<br />
function init() {<br />
var gallery = new studio.innovation.components.<strong>Swipe</strong><strong>Gallery</strong>(config);<br />
}<br />
Immediately following instantiation, you can set up listeners and callback for the SLIDE custom event. When a user<br />
slides to an image, the event slideX is raised where X is a number starting from 0 and counting upward depending<br />
on how many images are in the gallery.<br />
gallery.addEventListener('slide0', function() {<br />
console.log('slide0');<br />
Enabler.counter("slide - image 1");<br />
});<br />
gallery.addEventListener('slide1', function() {<br />
console.log('slide1');<br />
Enabler.counter("slide - image 2");<br />
});<br />
gallery.addEventListener('slide2', function() {<br />
console.log('slide2');<br />
Enabler.counter("slide - image 3");<br />
});<br />
gallery.addEventListener('slide3', function() {<br />
console.log('slide3');<br />
Enabler.counter("slide - image 4");<br />
});<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 />
To actually show the component you must call the render method and supply the parent container. The parent<br />
container can be any valid element.<br />
gallery.render(document.getElementById('gallery'));<br />
Finally, a method is available for you to jump to any slide in the gallery. The two parameters it takes are the slide<br />
index number (starting at index 0) and the animation duration, in milliseconds.<br />
gallery.slide(3, 300);<br />
gallery.slide(2, 3000);<br />
gallery.slide(0, 1000);
Additional Notes.<br />
Once finished your creative and all of its files should be uploaded to Studio exactly as you would do with any other Rich<br />
Media creative, for more information on uploading to Studio check out the help centre .here.<br />
<strong>Swipe</strong> <strong>Gallery</strong> is compatible with any <strong>HTML5</strong> format that’s uploaded to DoubleClick Studio and some more<br />
advanced sample files which use the swipe gallery component can be downloaded from the Resources section<br />
below.<br />
.Resources.<br />
.>. [DEMO] <strong>Swipe</strong> <strong>Gallery</strong><br />
.>. [FILES] Inpage Demo (Basic)<br />
.>. [FILES] Inpage with Video Demo (Advanced)<br />
.>. [FILES] Expanding Demo (Advanced)<br />
.>. [HELP DOCUMENTATION] Studio link to <strong>HTML5</strong> Information<br />
.>. [HELP DOCUMENTATION] Studio Enabler API/SDK Information<br />
.>. [HELP DOCUMENTATION] Setting up your creative in Studio<br />
.>. DoubleClick Rich Media Help Center<br />
.>. DoubleClick Rich Media Studio<br />
.>. DoubleClick Rich Media <strong>Gallery</strong><br />
.>. @rmgallery - DoubleClick Rich Media <strong>Gallery</strong> Twitter Account
Contact Us.<br />
If you still have any questions relating to this format or build then please feel free to contact our Rich Media<br />
Technical Support team through Doubleclick’s Help Center Contact Us form.<br />
About DoubleClick.<br />
For advertisers and publishers who need to reach a target audience, the <strong>Google</strong>’s DoubleClick product suite is<br />
an advertising platform that maximizes revenue growth and return on advertising spend through a unique and<br />
innovative ad targeting process. The experience and innovative spirit at DoubleClick drives a constant evolution of<br />
products and solutions, ensuring the best, most effective advertising tools are always at our customers’ command.<br />
.www.doubleclick.com.<br />
.www.richmediagallery.com.<br />
.DoubleClick NY: 76 Ninth Ave, New York, NY 10011.<br />
.www.google.com/doubleclick ©2012 <strong>Google</strong> Inc. All rights reserved..