我想为标题添加标题h2。
代码
<div class="row">
<div class="span12">
<h1 class="page-header"> Best Videos Ever ❤</h1>
</div>
</div>
<div class="row">
<div class="span3">
<ul id="videos-list">
</ul>
</div>
<div class="span9" id="video-watcher">
</div>
</div>
</div>
<script type="text/javascript" src="json.js"></script>
<script type="text/javascript" src="js.js"></script>
<script>
var videos = [
{"youtubeId": "QHWbzrCJ4nE",
"title": "Chappie",
"data": "http://www.omdbapi.com/?t=chappie&y=&plot=short&r=json"
},
{"youtubeId": "5Yab0sXGEjg",
"title": "Furious 7",
"data": "http://www.omdbapi.com/?t=furious+7&y=&plot=short&r=json"
},
{"youtubeId": "8ztAypW5MRE",
"title": "Runner",
"data": "http://www.omdbapi.com/?t=runner&y=&plot=short&r=json"
},
{"youtubeId": "SfZWFDs0LxA",
"title": "Fifty Grey of Shades",
"data": "http://www.omdbapi.com/?=Fifty+shades+of+Grey&y=&plot=short&r=json"
}
];
var addVideoToList = function(video) {
var videoLink = $('<a>');
videoLink.append(video.title);
var thumbnailUrl = youtube.generateThumbnailUrl(video.youtubeId);
var thumbnailImg = $('<img>');
thumbnailImg.attr('src', thumbnailUrl);
videoLink.append(thumbnailImg);
videoLink.on('click', function(e) {
e.preventDefault();
$.getJSON(video.data, function(data) {
var items = [];
$.each( data, function( key, val ) {
items.push( "<li id='" + key + "'>" + val + "</li>" );
});
$( "<ul/>", {
"class": "my-new-list",
html: items.join( "" )
}).appendTo( "body" );
});
var videoEmbed = $('<iframe></iframe>');
videoEmbed.attr('src', youtube.generateEmbedUrl(video.youtubeId));
videoEmbed.attr('width', 560);
videoEmbed.attr('height', 315);
var videoWatcher = $('#video-watcher');
videoWatcher.hide();
videoWatcher.html(videoEmbed);
videoWatcher.fadeIn();
});
var videoItem = $('<li>');
videoItem.append(videoLink);
$('#videos-list').append(videoItem); }
for (var i = 0; i < videos.length; i++) {
addVideoToList(videos[i]); }
</script>