Results 1 to 2 of 2

Thread: nth-child with JS

  1. #1
    Join Date
    Nov 2007
    Posts
    151
    Thanks
    67
    Thanked 0 Times in 0 Posts

    Default nth-child with JS

    Hi,

    I'm using nth-child in the following way, which is not supported on IE 8.
    How can I write a javascript command that will perform the same operation?

    HTML Code:
    table.tbl1 tr:nth-child(2n+2) td {  
    	background-color:#CEC5C1;
    }
    table.tbl1 tr:nth-child(2n+1) td {  
    	background-color:#F6F4F3;
    }
    ul#cat li:nth-child(4n+4) {  
        margin:0 0 20px 9px;
    }

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    This may be of interest to you: http://selectivizr.com/

    And this snippet with jQuery: http://ryan.sadwick.com/nth-child/

    This CSS-only workaround also looks interesting: http://abouthalf.com/development/poo...or-ie-7-and-8/
    Last edited by Beverleyh; 09-17-2013 at 11:14 AM.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Similar Threads

  1. problem with ul first child
    By plurcss in forum CSS
    Replies: 1
    Last Post: 08-25-2010, 02:24 PM
  2. Please Help With Last Child Loop
    By GreggH in forum JavaScript
    Replies: 2
    Last Post: 04-05-2009, 08:05 PM
  3. First-Child/Last-Child
    By sundevil67 in forum JavaScript
    Replies: 0
    Last Post: 01-27-2009, 06:55 PM
  4. Child Iframe resizing another Child Iframe window in a parent.
    By Adonias_d in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 05-16-2007, 12:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •