.hasClass method and if statement
Greetings all,please check this code: http://jsfiddle.net/RZpbK/1558/
now what i understand from :
if (!$target.hasClass('active') && $other.length > 0)
is always false,since $target already has class 'active' added by the previous function,if that's the case,how would this 'if statement' ever execute?
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...
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread