Need help with Scrolling text with Pause on MouseEnter and Resume on MouseLeave

Need help with Scrolling text with Pause on MouseEnter and Resume on MouseLeave

Im  very new to jquery and would like some assistance please.

I am trying to get scrolling text that pauses on mouse enter and resumes on mouse leave.

here is my current code:

  1. <!doctype html>

  2. <head>
  3. <meta charset="UTF-8">
  4. <title>Untitled Document</title>
  5. <link rel="stylesheet" type="text/css" href="css/style.css">
  6. <script type="text/javascript" src="scripts/jquery-3.1.1.js"></script>
  7. <script type="text/javascript" src="https://raw.github.com/tobia/Pause/master/jquery.pause.min.js"></script>

  8. </head>

  9. <body>


  10. <div class="outer">
  11. <div class="inner">
  12.   <h3>Scrolling down... line 3</h3>
  13.   <h3>Scrolling down... line 2</h3> 
  14.   <h3>Scrolling down... line 1</h3> 
  15. </div>
  16. </div>




  17. <script type="text/javascript">
  18. function run(){
  19.     var top = parseInt($(".inner").css("top").replace("px",""));
  20.     var height = $(".outer").outerHeight();
  21.     if(top <  height)
  22.     {
  23.        $(".inner").animate({"top":height},5000,run)           
  24.     }
  25.     else
  26.     {
  27.         $(".inner").css({"top":-height});
  28.         run();
  29.     }
  30.     
  31. }
  32. run();
  33. </script>
  34. <script type="text/javascript">
  35. $(document).ready(function() {
  36.     $(".inner").on("mouseenter",function(){
  37.         $(this).pause();
  38.     });
  39.     
  40.     $(".inner").on("mouseleave",function(){
  41.         $(this).resume();
  42.     });
  43. })
  44. </script>


  45. </body>
  46. </html>