jQuery .css() function not returning expected values

前端 未结 7 1344
情歌与酒
情歌与酒 2020-12-31 08:10

Alright, I\'ve search the jQuery docs (needs somebody devoted to maintaining), I\'ve searched SO, and I\'ve searched Google. I can\'t find the answer to this question.

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-31 08:17

    In the jQuery manual it is stated:

    The difference between .css(width) and .width() is that the latter returns a unit-less pixel value (for example, 400) while the former returns a value with units intact (for example, 400px).

    Seems like the behaviour of .css() was changed in version 1.3, or at least it seems like that from the bug tracker.

    I was trying to find a good (not hacky) solution also, but I haven't been able yet.

    Also on SO.

提交回复
热议问题