There is a block and a hidden paragraph. When you click on a block, a paragraph appears animatedly. The display animation has a stop method with values of 0.0 (false, false). But there are also conditional statements: if which is not executed for the first time. There is also a stop in his body, but with values of 1.1 (true, true). Question: why even if if not executed stop behaves as if it has a value of 1.1?
$(document).ready(function(){ $('.q1').click(function(){ if($(this).next().is(':visible')) // Это не выполняется т.к. Абзац ещё не виден $(this).next().stop(true,true).slideUp(); // Это не выполняется т.к. Абзац ещё не виден $(this).next().stop(0,0).slideToggle();//Так почему у stop ведёт себя будто у него значение true,true ? }); }); *{ margin:0; padding:0; } .q1{ width:50px; height:50px; background: red; } p{ width:150px; height:300px; background: black; display:none; } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> <div class="q1"></div> <p></p>
stopbehaves in the same way when no animation happens - Crantisz