当您在项目上按“Enter”时需要在列表中切换到相应的视频,即更改<video>
标记src=""
的属性。
JSON视频的路径:
data.query.results.channel.item.guide.content.url
的javascript:
$.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D'http%3A%2F%2Frss.cnn.com%2Fservices%2Fpodcasting%2Fac360%2Frss.xml'%20AND%20itemPath%3D%22%2F%2Fchannel%22&format=json&diagnostics=true&callback=?", function (data) {
// Load Titles patch Json
var titles = data.query.results.channel.item.guide.content.map(function (item) {
return item.title;
});
$(".container-list-podcast ul").append('<li>' + titles.join('</li><li>'));
// Load Navigation Only Key
a = $('.nav_holder li').keynav(function () {
return window.keyNavigationDisabled;
});
});
答案 0 :(得分:0)
试试这个:http://jsfiddle.net/Cf5QU/5/
$.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D'http%3A%2F%2Frss.cnn.com%2Fservices%2Fpodcasting%2Fac360%2Frss.xml'%20AND%20itemPath%3D%22%2F%2Fchannel%22&format=json&diagnostics=true&callback=?", function (data) {
// Load Titles patch Json
console.log(data.query.results.channel.item);
var titles = data.query.results.channel.item.map(function(item) {
return item.title;
});
var urls = data.query.results.channel.item.map(function(item) {
return item.origLink;
});
console.log(titles);
$(".container-list-podcast ul").append('<li>' + titles.join('</li><li>'));
$(".container-list-podcast ul li").each(function(key, value){
var text = $(this).text();
$(this).html('<a href="' + urls[key] + '">' + text + '</a>');
});
$(".container-list-podcast ul li a").click(function(){
var href = $(this).attr('href');
alert(href);
$("#myvideo").attr("src", href).get(0).play();
return false;
})
// Load Navigation Only Key
a=$('.nav_holder li').keynav(function() {
return window.keyNavigationDisabled;
});
});