A brief analysis of several small changes in jQuery1.8

  • 2020-03-30 00:45:44
  • OfStack

Methods.width() and.height()

In addition to setting the width to 500px, we also set the padding to 5px and the border to 5px. The results of each browser print are as follows




Chrome21 / Firefox14:480

Two,.outerwidth and.outerheight () methods

1.7.2 and previous versions, outerWidth/outerHeight are used as getters only. Returns the width or height of the element (including padding and border) without true, and returns the value plus margin.

1.8 and later have setter function, if you want to calculate margin when you get, you can only pass true, and you cannot pass the number 1, etc., because the number 1, etc., will be processed as setting the width and height of the element in jQuery. Instead of a number, it returns a jQuery object (like any other jQuery setter).

Related articles: