<script>
(function($, window, document, undefined) {
$.fn.testPlugin = function(options) {
this.each(function() {
$$ = this;
$(window).on('scroll',function() {
console.log($$);
})
});
}
})(jQuery, window, document)
$("#block1").testPlugin();
$("#block2").testPlugin();
<script>
为什么它只显示#block2 元素而不是同时记录block1 和block 2?