jquery类的操作 (小白必看)
类属性的添加
$('.box').addClass('类名1 类名2');
类属性的移除
$('.box').removeClass('类名')
类属性的 切换(有的话移除没有的话添加)
$('.box').toggleClass('类名')
类属性的判断(判断这个box是否有这个类,返回true和false)
var x=$('.box').hasClass('类名')
相对于文档的偏移
var x=$('.box').offset({'top':0,'left':0});
相对于父节点偏移 (父节点添加定位如果没有相对于文档)
var x=$('img').position();//获取
$('.box')position({'top':0,'left':0})
元素滑动条位置
$(window).scrollTop(500)
$(window).scrollLeft(500)
元素大小
$('.box').width()//content
$('.box').innerWidth()//content+padding
$('.box').outerWidth()//content+padding+border
$('.box').outerWidth(true)//content+padding+border+margin
页面加载
$(()=>{
})//(也是一个匿名函数)