2011-07-21 34 views
0

當你第一次點擊答案文本區域,就會彈出一個消息框如何使JavaScript覆蓋幻燈片?

Your Answer 
Thanks for contributing an answer to Stack Overflow! 

Please make sure you answer the question; this is a Q&A site, not a discussion forum. 

Provide details and share your research. Avoid statements based solely on opinion; 
only make statements you can back up with an appropriate reference, or 
personal experiences. 

enter image description here

我掙扎在我自己的系統來實現這一點。我已經檢查了jQuery slideUp function,但是它將文字信息框下滑爲不起來。

是否有人知道如何實現它?

我假設它使用JavaScript動畫。

+0

還有就是如何在這裏[這裏] [1] [1]做彈出窗口使用jQuery描述:http://stackoverflow.com/questions/1328723/how-to-產生,使用,jQuery的A-簡單彈出式 – Soren

+0

有是怎麼做彈出窗口[這裏] [1] [1]的描述:http://stackoverflow.com/questions/1328723/how -to-generate-a-simple-popup-using-jquery – Soren

+0

你對這個問題有任何相關的代碼嗎? – ghayes

回答

0
<!DOCTYPE html> 
<html> 
    <head> 
    <script src="http://code.jquery.com/jquery-latest.js"></script> 
    <style type="text/css"> 
     .div1 { 
     width:400px; 
     height:100px; 
     border: 1px solid #777777; 
     } 
     .div2 { 
     width:400px; 
     height:100px; 
     border: 1px solid #777777; 
     overflow:hidden; 
     } 
     .help { 
     background-color:#fefae2; 
     border: 1px solid #f3eed5; 
     width:400px; 
     height:100px; 
     margin-top:100px; 
     } 
     .info-ok{ 
     font-size: 13px; 
     color:#1087a4; 
     float:right; 
     margin-top:5px; 
     margin-right:5px; 
     } 
     .info-head{ 
     font-size: 15px; 
     font-weight: bold; 
     margin-top:15px; 
     margin-right:5px; 
     } 
    </style> 
    </head> 
    <script type="text/javascript"> 
    function popdown(){ 
    $(".help").animate({ 
    marginTop:"100px", 
    }, 1000); 
    } 
    function popup(){ 
    $(".help").animate({ 
    marginTop:"0px", 
    }, 1000); 
    } 
    </script> 
    <body> 
    <div class="div1">a</div> 
    <div class="div2"> 
     <div class="help"> 
    <a class="info-ok" onclick="popdown()">ok</a> 
    <p class="info-head">您的答案</p> 
    <p>感謝您對StackPointer做的貢獻</p> 
    <p>請確保您回答這個問題,這是一個問答網站,而不是一個論壇</p> 
    <p></p> 
     </div> 
    </div> 
    <div class="div3">c</div> 
    <textarea onclick="popup()"></textarea> 
    </body> 
</html> 
0

假設你的textarea是這樣

<textarea id='answer'></textarea> 

所以你可以使用

$('textarea#answer').bind('click', function() {alert('Thanks')}) 
+0

警報(「謝謝」)將只彈出一個窗口,我不想吳丹 – mike

+0

你可以寫在功能所需要的代碼()。我的意思是首先你可以帶一個隱藏的div,然後你可以用$('div#message')。show('fast')顯示它。這取決於你的想象力和要求,但是這是你的基本指導 –

2

我不知道你想要什麼,是this呢? 我想你想使用.slideToggle()

HTML

<textarea></textarea> 
<div class="msg"> 
    謝謝你!! 
</div> 

jQuery的

$(".msg").slideToggle(); 
    $("textarea").focus(function(){ 
     $(".msg").slideToggle(); 
    }); 
    $("textarea").blur(function(){ 
     $(".msg").slideToggle(); 
    }); 

你想要什麼出現是什麼時候?

+0

ye,但是如果你把textarea放在div的下方,當它點擊textarea時,textarea會倒下,我需要textarea不要移動,只要div滑動 – mike

+0

http://jsfiddle.net/mazlix/EXyxb/5/只是額外的CSS,我會張貼更新到我的jsfiddle,但它只是一個使用'position:absolute'的問題,如果你顯示我是你想要它看起來像我可以幫助更多的例子...我不知道您想要什麼 – mazlix

+0

真的,我會嘗試 – mike