5

How to select all siblings of an element that are positioned to the right of it via css? fiddle link

Brainache
  • 87
  • 3
  • 7

1 Answers1

4

You can use filter() to return a subset of a selector based on a function you provide, try this:

var threeLeft = $("#three").position().left;
var $lis = $("ul li").filter(function() {
    return $(this).position().left > threeLeft;
});
$lis.css("border", "1px solid #C00");

Example fiddle

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
  • Perfect - Figured I needed a filter but couldn't work out the position() bit. Thanks a lot Rory - appreciate your help. – Brainache Apr 01 '12 at 15:09