How to stop in a function through the console?

2

I would like to stoke a fadeIn () during its execution so that the screen stays exactly as it was the moment I stopped.

The ideal would be something generic, that works for fadeIn, slideUp, slideDown, setTimeout etc.

Is it possible to do this using the browser console? What would it be like?

    

asked by anonymous 15.05.2015 / 14:55

1 answer

2
$( "seu-elemento" ).stop();

This method is used to stop animations in general.

.stop () | JQuery API

Example taken from jQuery:

// Start animation
$( "#go" ).click(function() {
  $( ".block" ).animate({ left: "+=100px" }, 2000 );
});
 
// Stop animation when button is clicked
$( "#stop" ).click(function() {
  $( ".block" ).stop();
});
 
// Start animation in the opposite direction
$( "#back" ).click(function() {
  $( ".block" ).animate({ left: "-=100px" }, 2000 );
});
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>stop demo</title>
  <style>
  div {
    position: absolute;
    background-color: #abc;
    left: 0px;
    top: 30px;
    width: 60px;
    height: 60px;
    margin: 5px;
  }
  </style>
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script></head><body><buttonid="go">Go</button>
<button id="stop">STOP!</button>
<button id="back">Back</button>
<div class="block"></div>
 
</body>
</html>
    
15.05.2015 / 15:04