Carousel.init() 傳入時(shí)是jquery對象 為什么在each中還要將this包裝成$(this)?
Carousel.init($('.J_Poster')) ; 這里傳入的是jquery對象?。?/p>
Carousel.init = function(posters){
? var _this_ = this;
? posters.each(function(i, elem){
? ? new _this_($(this)); ?// 這里的this按理說應(yīng)該已經(jīng)是上面的jquery對象了,為什么還要包裝一下了?
? });
}
2016-04-12
此處$('.J_Poster')為一個(gè)集合,$(this)表示的是這個(gè)集合中的一個(gè),通過each()依次遍歷,為每一創(chuàng)建一個(gè)Carousel對象