jQuery实例方法-位置图形、遍历索引

位置图形

// offset
// {left: , top: }
// console.log( $('.demo').offset() );
// $('.demo').offset({left: 100, top: 100});

// position
// 和css定位规则相同
// console.log( $('.demo').position() );
// $('.demo').position({left: 100, top: 100});

// scrollTop scrollLeft
// width height //content
// innerWidth innerHeight // content + padding
// outerWidth outHeight //content + padding + border 加参数true加上margin

遍历索引

// each
// $('li').each(function(index, ele){
//     $(ele)
//         .text(index)
//             .addClass('demo' + index);
// })

// index
// $('ul').on('click', 'li', function(e){
//     console.log($(e.target).index());
// })