youmightnotneedjquery.com
UPD.
$(this).parents('.portfolio')
function parents(el, selector) {
const p = [];
while ((el = el.parentNode) !== document && el) {
(!selector || el.matches(selector)) && p.push(el);
}
return p;
}
parents(this, '.portfolio')
$(this).parent('.portfolio')
this.parentNode.classList.contains('portfolio') ? this.parentNode : null
$(this).children('.portfolio')
[...this.children].filter(n => n.classList.contains('portfolio'))
// или
Array.prototype.filter.call(this.children, n => n.matches('.portfolio'))
// или
this.querySelectorAll(':scope > .portfolio')
$(this).find('.portfolio')
this.querySelectorAll('.portfolio')
$(this).next('.portfolio')
(el => el && el.matches('.portfolio') ? el : null)(this.nextElementSibling)