javascript - How to apply a callback to multiple elements? -


i have following callbacks. if start player going show me second callback. how can make callback , show both videos random?

callback('{"video": {"mp4": "http://c0026122.cdn1.cloudfiles.rackspacecloud.com/193807.mp4", "webm": "http://5860e9e4db2f4cebe1e6-cc12bb9b5e092d34d0fadb7ce5f280a3.r47.cf1.rackcdn.com/193807.webm", "title": "touch"}}'); callback('{"video": {"mp4": "http://c0026125.cdn1.cloudfiles.rackspacecloud.com/064915.mp4", "webm": "http://a95a046574a64b9ea43b-53264ce826f5cfe73ee69a0c3c37eccc.r68.cf1.rackcdn.com/64915.webm", "title": "grace / fever / dinner / heart heart / videogame"}}'); return; 

if you're asking think you're asking , show random video, may want consider generating random number array of videos.

var videos = [ // place , videos in array     {"video": {"mp4": "http://c0026122.cdn1.cloudfiles.rackspacecloud.com/193807.mp4", "webm": "http://5860e9e4db2f4cebe1e6-cc12bb9b5e092d34d0fadb7ce5f280a3.r47.cf1.rackcdn.com/193807.webm", "title": "touch"}},     {"video": {"mp4": "http://c0026125.cdn1.cloudfiles.rackspacecloud.com/064915.mp4", "webm": "http://a95a046574a64b9ea43b-53264ce826f5cfe73ee69a0c3c37eccc.r68.cf1.rackcdn.com/64915.webm", "title": "grace / fever / dinner / heart heart / videogame"}} ];  var rand = math.floor(math.random() * videos.length); // generate random number based on number of videos  callback(videos[rand]); // run callback random video 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -