mardi 12 juillet 2016

how use .toggleClass() in this code


hello guys i have this code

panelPlusK.append('<div id="foo">click To change the style</div><br>');

$('#foo').click(function() {
    $('.agario-panel').css({
        'background-color': 'rgba(32, 68, 102, 0.72)',
        'color': '#E91E63',
        'border-color': '#2196F3',
    });
    $('.agario-panel').css({
        'background-color': 'rgba(44, 125, 116, 0.55)',
        'color': '#23ff8d',
    });
});

i want to make it when i click on it then it changes the style but when i reclick on it again then it remove the style ..i saw toggleClass fuction but i dont know how to implemt it there


Aucun commentaire:

Enregistrer un commentaire