Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use stop() method in jQuery ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 175
    Comment on it

    Welcome to findnerd, today we are going to discuss on stop() method in jQuery.

    Firstly let know what is the use of stop() method ?

    So basicaly stop() method is used for stoping animations or effects before it is finished.

    syntex of stop() method

    1. $(selector).stop();

    You can see bellow example:

    1. <!DOCTYPE html>
    2. <html>
    3. <head>
    4. <!-- here call the jquery library -->
    5. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    6. <script>
    7. $(document).ready(function(){
    8. $("#start").click(function(){
    9. $("#work").slideDown(5000);
    10. });
    11. $("#stop").click(function(){
    12. $("#work").stop();
    13. });
    14. });
    15. </script>
    16.  
    17. <style>
    18. /*here write css of text and background color*/
    19. #work, #start {
    20. padding: 10px;
    21. font-size: 18px;
    22. text-align: center;
    23. background-color: #7FFFD4;
    24. color:#000;
    25. border: solid 1px #c3c3c3;
    26. border-radius: 3px;
    27. width:220px;
    28.  
    29. }
    30. /*define padding of work id*/
    31. #work {
    32. width:220px;
    33. padding: 10px;
    34. display: none;
    35. }
    36. </style>
    37. </head>
    38. <body>
    39. <!-- here define a button and define it's id -->
    40. <p><button id="stop" style=" background-color: #7FFFD4; padding: 10px;">Stop Button</button></p>
    41.  
    42. <div id="start">Click here to slide</div>
    43. <div id="work">Working Fine!</div>
    44.  
    45. </body>
    46. </html>

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: