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