0

i write this code , it make a slideUp for me now I need when mouse over stop slide up regard

$(document).ready(function () {
$('#ticker_02').mouseover(function() {
  //I NEED THIS CODE
    })

});

function tick2(){
    $('#ticker_02 li:first').slideUp( function () { $(this).appendTo($('#ticker_02')).slideDown(); });
}
setInterval(function(){ tick2 () }, 2000);
Mr-EsSi
  • 60
  • 1
  • 7

3 Answers3

1

try stop() method:

$('#ticker_02').mouseover(function() {
  $(this).stop(true);
})
Ram
  • 143,282
  • 16
  • 168
  • 197
  • hi, if you slide the `li:first` try it by changing the selector `$('#ticker_02 li').mouseover(...)` – Ram May 27 '12 at 09:16
  • Thank I solve this . my problem setInterval(function(){ tick2 () }, 2000); . stop worked but this start again . – Mr-EsSi May 27 '12 at 09:19
0

function tick2(){
  $('#ticker_02 li:first').slideUp(
    function () {
      $(this).appendTo($('#ticker_02')).slideDown();
    }
  );
}

d=setInterval(function(){ tick2 () }, 5000);

function stop1(){
  clearInterval(d);
}
function start1(){
  d=setInterval(function(){ tick2 () }, 5000);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul id="ticker_02" class="ticker" onmouseover="stop1()" onmouseout="start1()" >
  <li>element1</li>
  <li>element2</li>
</ul>
rocambille
  • 15,398
  • 12
  • 50
  • 68
0

Try This.

<ul id="ticker_02" class="ticker" onmouseover="stop1()" onmouseout="start1()">

<script>
var d
function tick2(){
    $('#ticker_02 li:first').slideUp( function () {    
        $(this).appendTo($('#ticker_02')).slideDown(); });
}
d=setInterval(function(){ tick2 () }, 2000);


function stop1(){
    clearInterval(d);
}

function start1(){
    setInterval(function(){ tick2 () }, 2000);
}
</script>
Michel Keijzers
  • 15,025
  • 28
  • 93
  • 119