ok so here is my code
HTML:
<div id="cta-end"><h1>Modification</h1></div>
<div id="bloc1"></div>
<div id="bloc2"></div>
CSS:
#cta-end
{
width:100%;
background-color:red;
text-align:center;
}
#cta-end:hover
{
cursor:pointer;
}
#bloc1, #bloc2
{
width: 100%;
height: 50px;
margin: 5px 0;
display:none;
}
#bloc1{
background-color:blue;
}
#bloc2{
background-color:grey;
}
and jQuery :
$(document).ready(function(){
$('#cta-end').click(function(){
$('#cta-end').toggle(function () {
$('#bloc1').css({"display":"block"});
$('#bloc2').css({"display":"block"});
},
function () {
$('#bloc1').css({"display":"none"});
$('#bloc2').css({"display":"none"});
}
);
});
});
What I am trying to do, is that when cta-end is clicked, the two divs bloc1 and bloc2 display, and when i click another time on cta-end it displays none.
My code doesn't work at all. I guess I'm not using the toggle() function as it should be used.
I just want to switch the two functions any time cta-end is clicked..
here is the code on jsfiddle
thank you !