var $target = $($(this).attr('href')),
$other = $target.siblings('.active')
var target point to the href attr of the link. eg "#target1"
so, !$target.hasClass('active') is equal to jQuery('#target1').hasClass('active')
the class is added to the panels next to the links, so in this way, every time that is clicked a link, the code assesses whether it has the class 'active' or not... but remember that assesses if the div.panel has the class, not the link...