Ever want to automatically rotate through a series of images (or other content) in the small view of a Yahoo! Application Platform (YAP) app? Well, if so, here’s some code to do it.
The top of the script gives instructions for usage, and defines an items array containing the content to display.
Below that, we adjust the starting point for extracting the items to display from the array. A start param passed to the app defines the starting point. If this param exceeds the amount of elements in the array, the start point is set to zero.
At the bottom, the script produces markup to display three of the items from the items array and a yml:include tag set to fire off a request back to the script for the next set of items after a brief delay.
Please feel free to use derivations of this code in your work, but be sure to implement proper security and validation before exposing the code to live traffic.
For the feed readers, here’s a link to the code on Github.
Here's a screenshot of the script in action:
Image credit: YDN
Erik Eldridge (@erikErik Eldridge)
Yahoo! Developer Network