JQuery - Detect CSS display support: table-row-group '

Thus, Internet Explorer <= 8 does not accept the default values table-rowand table-row-groupproperty the CSS display(among others). I do not recommend using jQuery browser discovery features as they are deprecated. How can I detect support table-row-groupin jQuery without parsing the browser / user agent string? That is, how to determine the presence of a function, and not the presence of a specific browser?

+3
source share
3 answers

I do not believe that with Javascript you can directly detect CSS property support. I have two recommendations if this is true:

  • Insert two elements into the hidden div, one with table-rowand one without. See if there is a difference in height or width. If so, calculate the height or width by finding out the difference between a browser that supports it and one that does not.

  • Although jQuery browser detection is out of date, you can locally host the script:

http://www.tvidesign.co.uk/blog/CSS-Browser-detection-using-jQuery-instead-of-hacks.aspx

I use it and I like it! It adds two classes to the body tag (for example, ".browserIE7 and .browserIE"), so you can use Javascript ( if $('body').hasClass('browserIE7')...) or CSS ( .browserIE7.div {...)

Good luck

Edit

, Javascript... 3- : http://perfectionkills.com/feature-testing-css-properties/, .

+1

CSS , IE, :

<!--[if lte IE 7]>
        <script type="text/javascript">
            var ie7 = true;
        </script>
<![endif]--> 

<!--[if lte IE 6]>
         <script type="text/javascript">
            var ie6 = true;
        </script>
<![endif]-->

- ... , , , .

CSS , , , IE . CSS JS-, JS-.

0

Modernizr . CSS, <html>. , .

You can learn more about Modernizr on your website: http://www.modernizr.com/

0
source

Source: https://habr.com/ru/post/1763715/


All Articles