Setting a data
attribute as you are means that it is stored in jQuery's cache (which is an object in memory), it does not get set as an attribute on the element and therefore no CSS selector will see it.
You would need to manually set the data
attribute using attr
for this to work:
$('.card-container').attr('data-position', 'left');
Note however, that this will see slightly reduced performance when retrieving the data value, although we're talking miliseconds.