jQuery check if browser support position: fixed

后端 未结 7 695
灰色年华
灰色年华 2021-01-04 09:13

How do I check if browser supports position:fixed using jQuery. I assume I have to use $.support I think, but how?

Thank you for your time.

7条回答
  •  情书的邮戳
    2021-01-04 10:02

    The most reliable way would be to actually feature-test it. Browser sniffing is fragile and unreliable.

    I have an example of such test in CFT http://kangax.github.com/cft/#IS_POSITION_FIXED_SUPPORTED. Note that the test should be run after document.body is loaded.

提交回复
热议问题