2013-03-26 53 views
-3

我知道我的問題可能很煩人,因爲我詢問了一些對您來說容易的事情,當然我可以自己檢查它,但對我來說太難了。我可以找到div的寬度和高度,找到背景顏色和字體,但我找不到代碼來執行你可以在這裏找到的東西: http://easyelo.com/ 在常見問題中,在頁面底部附近,你點擊>>,並顯示附加文字和說明。 我不知道如何檢查它在做什麼。有人能幫助我嗎?分析代碼 - 我找不到源代碼如何寫

<div class="more" style="font-family: arial; margin-bottom: 10px; margin-top: 10px; display: block;"> 
       <i style="line-height: 20px; font-size: 15px;font-family:arial;">Sorry, we don’t do any jobs until they are paid for; however, we do allow you to pay in increments as small as 10 euro. </i> 
       </div> 
+0

對我來說看起來像是手風琴http://css-tricks.com/snippets/jquery/simple-jquery-accordion/ – gaynorvader 2013-03-26 16:00:33

+1

easyelo.com上的這個解決方案甚至更簡單,只是[.slideToggle()](http: //api.jquery.com/slideToggle/)來自jQuery。 – 2013-03-26 16:02:15

回答

3

這裏有一個簡單的解決方案:

使用下面的代碼來創建的元素:

<div id="mainLine">The immediately visible part of the thing here. <a href="#" id="more">>></a> 
<p id="hiddenText">This thing appears and disappears as you click the '>>' at the end.</p> 

,並使用此jQuery腳本隱藏元素時,頁面加載,然後只顯示它當點擊'>>'時:

$(document).ready(function(){ 
$("#hiddenText").hide();}); 

$(document).ready(function(){ 
$("#more").click(function(){ 
    $("#hiddenText").slideToggle("slow"); } 
       ); 
}); 

如果你有興趣,這裏是CSS從「>>」 emoves下劃線:

a 
{ 
text-decoration: none; /* I'm trying to make it look more like the original */ 
} 

你可以找到http://jsfiddle.net/2b7Vp/

工作的例子這是我的第一個答案在SO &我希望這可以幫助你(部分來自@Pavel斯特巴的評論被盜。謝謝!)。