Below is the snippet of code:
$('> li', this).each(function (index) {
var top_space = $(this).css('padding-top');
$(this).prepend('<div></div>');
$('> div', this).css({
position: "absolute",
top: -top_space,
width: "100%",
height: top_space,
"z-index": 0
});
});
Upon inspecting the element, here is the output:
Notice the absence of the top attribute, however, when the negative sign is removed...
There is a top attribute displayed, but unfortunately it remains at top:0
Despite spending nearly an hour on this, I am unable to pinpoint the issue. What might I be overlooking?