I'm trying to run the following jQuery Code.
$('body.player').find('.tab').click(function(){
$('.playerLoaders').addClass('loading');
setTimeout(function() {
if( !$(this).hasClass('active') ){
$('.playerLoaders').removeClass('loading');
$('.tab-content[data-tab="' + $(this).attr('data-tab') + '"]').addClass('active').siblings().removeClass('active');
$(this).addClass('active').siblings().removeClass('active');
}
return false;
},5000);
});
But something is not working quite right.
The div-tag "playerLoaders" is working perfectly, but the tab-content-div is not removing the active class, and adding it to the active tab.
If I delete the TimeOut-function, the tabs are working just fine.
What am I doing wrong?
.playLoaderswill change on the click... everything else waits 5 seconds, then runs IF it doesn't have the.activeclass.