2015-12-29 27 views
-1

有人可以讓我簡單,容易理解旋轉木馬的JS。我不太瞭解「this」的用法,那麼你能解釋一下發生了什麼嗎?如何使用函數製作簡單的傳送帶?

div{ 
 
    height: 100px; 
 
    width: 100px; 
 
    display: inline-block; 
 
} 
 
div:nth-child(1) { 
 
    background-color: red; 
 
} 
 
div:nth-child(2) { 
 
    background-color: blue; 
 
} 
 
div:nth-child(3) { 
 
    background-color: green; 
 
} 
 
.no { 
 
    display: none; 
 
}
<div> 
 
    <div class="yes"></div> 
 
    <div class="no"></div> 
 
    <div class="no"></div> 
 
    <ul> 
 
    <li>left</li> 
 
    <li>right</li> 
 
    </ul> 
 
</div> 
 
<div> 
 
    <div class="yes"></div> 
 
    <div class="no"></div> 
 
    <div class="no"></div> 
 
    <ul> 
 
    <li>left</li> 
 
    <li>right</li> 
 
    </ul> 
 
</div>

+0

'this'通常是一個JavaScript關鍵字。所以你需要向我們展示了一些'js'讓你明白,你沒有 –

+0

唐代碼的一部分在提供的代碼中沒有看到對'this'的任何引用。我錯過了什麼嗎? – DinoMyte

+0

對我來說Google似乎不是...這是Google嗎? –

回答

-3
div:nth-child(1) { 
background-color: red; 
} 

that means this CSS apply only on all first child div whose parent is <div> tag 

First parent div's inside four child , three div and one <Ul> so basically according to our CSS it apply it on first div (color red). 

second and third <div> block is hidden due to class ".no" containing display none property 
+0

我已經解釋了你是如何工作的。你無法得到它? –

+1

*不要..ahh ..沒問題,你甚至可以得到這個問題嗎?你爲什麼要解釋CSS? –

+0

你想要什麼。我將爲此而不是css做一個jquery函數。但告訴我是否存在修復div或n個div div –

相關問題