Jason Biondo
Jason Biondo

Reputation: 834

jQuery: Select an Element by Knowing it's Left Position

How can I select an element by left position?

I want to do something like this:

$(".timeline_item").find("Where left position === 300");

Upvotes: 0

Views: 99

Answers (3)

Shahin
Shahin

Reputation: 12841

Something like this should work

    $(".timeline_item").filter(function() {
  return $(this).css("left") == 300;
});

Upvotes: 0

xdazz
xdazz

Reputation: 160863

You could check it with .position():

$(".timeline_item").filter(function() {
  return $(this).position().left == 300;
});

Upvotes: 0

Dogbert
Dogbert

Reputation: 222198

This will return all .timeline_item with left == 300

$(".timeline_item").filter(function() {
  return $(this).css("left") == 300;
});

Upvotes: 3

Related Questions