jQuery table styling vs CSS table styling for alternate rows -
Is it possible to use CSS with classes on tables for strangers / even rows generated on the server Or is it faster / better to use jQuery? document.Ready ()
on ?
Style Stripe I would like to start using jQuery to minimize my markup, but I'm not sure about this performance, especially for large (up to 200 rows) tables
You can not have any choice based on browser. JQuery will work with older browsers like IE 7 which does not have anth child selector.
Ideally you should use CSS. The stylesheets are the best places to go.
I will use CSS with Javascript backup for the old browser, for example, if you want Zebra to try all the tables:
tr: Nth-child (2n + 1), tr.odd {background: # 911100; } Tr: nth-child (2n), tr.even {background: # 222200; }
and add .odd and .even classes in jQuery if the browser is outdated.
// You will have to check which browsers do not support n-th babies but I suspect that for example would be IE ... if ($ .mobile.mms & amp; $ .browser.version & lt; 9) {$ ('tr: weird'). AddClass ('weird'); $ ('Tr: even'). AddClass ('too'); }
Comments
Post a Comment