<div class="nt-why-box">1</div>?<div class="nt-why-box">2</div>?<div class="nt-why-box">3</div>?<div class="nt-why-box">4</div>?? ???? <script>?? ??? ??? ?$(function(){?? ??? ??? ??? ?$(".nt-why-box").click(function(){?? ??? ??? ??? ??? ?var aa=0;?? ??? ??? ??? ??? ?$(this).addClass("nt-why-te").siblings().removeClass("nt-why-te");?? ??? ??? ??? ??? ?console.log($(".nt-why-box").index($(this)))?? ??? ??? ??? ??? ?aa=$(this).index()?? ??? ??? ??? ??? ?console.log(aa);?? ??? ??? ??? ?});?? ??? ??? ?})?? ???? </script>
我的代碼里$(".nt-why-box").index($(this))和$(this).index()給出的值為什么不一樣,后面一個加了2?
肖小波
2016-08-09 09:35:42