[JQuery] css operations

Original link: https://www.mk2048.com/blog/blog.php?id=h0jhiijij2ab&title=%E3%80%90JQuery%E3%80%91css%E6%93%8D%E4%BD%9C

I. Introduction

        Then the contents of the last chapter, to continue learning JQuery

 

Second, the contents

css  设置或返回匹配元素的样式属性
     $(selector).css(css-property-name)
     $(selector).css(css-property-name,value)
     $(selector).css({property:value, property:value, ...})
     $(selector).css(css-property-name,function(index,currentvalue))


height  设置或返回匹配元素的高度
     $(selector).height()
     $(selector).height(num)
     $(selector).height(function(index,currentheight))


width  设置或返回匹配元素的宽度
     $(selector).width()
     $(selector).width(num)
     $(selector).width(function(index,currentwidth))


position  返回匹配元素相对于父元素的位置(偏移)
          返回的对象包含两个整型属性:top 和 left
     $(selector).position()


scrollLeft  设置或返回匹配元素相对滚动条左侧的偏移
     $(selector).scrollLect()
     $(selector).scrollLeft(new-position)


scrollTop   设置或返回匹配元素的滚动条的垂直元素
     $(selector).scrollTop()
     $(selector).scrollTop(offset)


offset  返回或设置匹配元素相对于文档的偏移
     $(selector).offset()
     $(selector).offset(value)
     $(selector).offset(function(index,currentoffset))


offsetParent  返回最近的祖先定位元素
     $(selector).offsetParent()

 

   


More professional front-end knowledge, make the [2048] ape www.mk2048.com

Guess you like

Origin blog.csdn.net/whiteGay/article/details/102743073