2013-07-22 24 views
0

https://dl.dropboxusercontent.com/u/99737964/video%20online/sermonvideos.html需要更改與視頻相關的文本信息

我是jquery,javascript和一般編碼的新手。我製作了一個媒體播放器,可以點擊並在一個盒子中顯示不同的視頻,但現在我想知道如何讓文字顯示在視頻框右側,它將顯示視頻標題和信息。我現在有文字出現,但我不明白如何在點擊新視頻後讓以前的文字消失。檢查網址以查看。感謝幫助!

從網站獲取源代碼。

+0

像你使用相同的方式出現視頻 – Hushme

+0

,基本上你需要一個jQuery的標籤菜單在網上搜索它,你會得到它 – Hushme

回答

0

使用jQuery的.html().text()功能,給idclass到將包含如點擊視頻的標題和信息的元素:

<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> 
相關問題