click - What is wrong with the following jQuery -
the following jquery nothing. did miss comma or something?
<script> $(".link<? echo $counter; ?>").click(function () { $('.sub').toggle(function () { $(".sub<? echo $counter; ?>").animate({ height: ($(this).parent().height() * <? echo(count($$vari)); ?> ) + 20 }, 1000); }, function () { $(".sub<? echo $counter; ?>").animate({ height: 0 }, 1000); }); }); </script>
the console not trow error's , when change code
<script> $(".link<? echo $counter; ?>").click(function() { $(".sub<? echo $counter; ?>").animate({ height: ($(this).parent().height() * <? echo (count($$vari)); ?>) + 20 }, 1000 ); }); </script>
the script works (except toggle ofcource)
the toggle()
function used way has been removed in jquery 1.9, , shows , hides elements. php outputs impossible know, should'nt use shorttags ?
also note binding click inside click, , everytime .link*
elements clicked, new event handler bound .sub
elements.
Comments
Post a Comment