我目前正試圖實現一個內容鎖定系統到我的網站,並作爲它的一部分想鎖定一個現場的MP3播放器,直到用戶完成了一個提議。DIV交換onclick
所以當頁面加載時顯示播放器,但如果他們嘗試點擊它,它會彈出內容鎖定器,並且一旦他們完成了一個報價,它就交換完整可用播放器的DIV。
下面的代碼:
<div id="mobmp3">
<div id="yoursecDiv" style="display:block; z-index: 999;"> <a href="javascript:void(0)" onclick="var fileref=document.createElement('script');fileref.setAttribute('type','text/javascript'); fileref.setAttribute('src', 'http://c.themixtapesite.com/locker.js?guid=0512eafd69b18d22');document.body.appendChild(fileref); setTimeout(yourFunction, 3000);">
<iframe src="http://themixtapesite.com/wp-content/plugins/amazon-s3-cloud-mp3-player/html5/html5mob2.php?bucket=mixtape2" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" width="97.4%" height="280" max-width="97.4%">
</iframe>
</a>
</div>
</div>
<!-- Place the Real Link within yourfirDiv which is set to not display
until yourFunction has been executed. -->
<div id="yourfirDiv" style="display:none;">
<iframe src="http://themixtapesite.com/wp-content/plugins/amazon-s3-cloud-mp3-player/html5/html5mob2.php?bucket=mixtape2"
frameborder="0" marginheight="0" marginwidth="0" scrolling="no" width="97.4%"
height="280" max-width="97.4%"></iframe>
</div>
所以,你可以看到,我試圖內yoursecDiv
加載一個iframe(播放器)。那麼一旦他們完成了提議,它會重新加載yourfirDiv
這是同一個玩家,但沒有內容儲物櫃。
我希望通過將包裝在<a>
標籤中,我會實現這一點,但唉,它不起作用。
所以我想我的問題是: 有沒有辦法,我可以覆蓋一個div(或東西)的iframe作爲鏈接打開內容更衣室?
你不能顯示一個div(儲物櫃),當你想啓用它時,使用jQuery隱藏div並顯示播放器?通過查看代碼,這難道不容易嗎? – 2013-03-06 13:20:35