I am trying to slideToggle and then afterwards toggleclass, but by adding the toggleclass the slideToggle does not 'slide' anyone know how i can fix this?
fiddle and code below.
$(function () {
$(".expand").on("click", function () {
$(this).next().slideToggle().toggleClass('slidein');
$expand = $(this).find(">:first-child");
if ($expand.text() == "\u25B6") {
$expand.text("\u25BC");
} else {
$expand.text("\u25B6");
}
});
});
It is working perfectly, but you hide the element and THEN add the class, so you can not see the
toggleClass
.You made some mistakes in the CSS file and in the logic of JS. remove the CSS3 transitions and it will works ok.
Finally, sort the code without the
toggle
methods, like this:See my working demo: JSBIN. Is it what you need to have?