https://dl.dropboxusercontent.com/u/99737964/video%20online/sermonvideos.html
我对jquery、javascript和编码都是新手。我已经制作了一个媒体播放器,我可以点击它,让不同的视频出现在一个框中,但现在我想知道如何让文本显示在视频框的右侧,它将显示视频标题和信息。我现在有文字显示,但我不明白如何让以前的文字在点击新视频后消失。检查url以查看。感谢您的帮助!
从站点获取源代码。
发布于 2013-07-22 09:10:09
使用jquery的.html()或.text()函数,将id或class赋予一个元素,该元素将包含所点击视频的标题和信息,如下所示:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('.videos').click(function() {
var value = $(this).attr('title');
$('#myInfo').html(value); //this should do the trick or
$('#myInfo').text(value); //this should do the trick
})
});
</script>和html
<div class = "videos" title = "this is an information">video 1</div>
<div class = "videos" title = "this is an information">video 2</div>
<div class = "videos" title = "this is an information">video 3</div>
<div class = "videos" title = "this is an information">video 4</div>
<div class = "videos" title = "this is an information">video 5</div>
<div id = "myInfo"></div>https://stackoverflow.com/questions/17778523
复制相似问题