If setInterval is chrome, it does not work properly.

Asked 2 years ago, Updated 2 years ago, 103 views

setInterval(function(){
    $('.test') .fadeOut(500, function(){$(this).fadeIn(500)});
},2000);

I'd like to blink the text with test in the class name.
IE keeps blinking, but chrome stops blinking once.
It specifies 2000 milliseconds, but chrome works fine at 1000 milliseconds.
What should I do if I specify 2000 milliseconds?

html

2022-09-30 21:32

1 Answers

My environment is as follows, but it seems to be working even with 2000 milliseconds.

chrome version: 67.0.3396.99 (Official Build) (64-bit)

Will the following code work in @html's chrome environment?
Also, are there any error messages on the console when it doesn't work?

setInterval(function(){
    $('.test') .fadeOut(500, function(){$(this).fadeIn(500)});
},2000);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p class="test">hoge</p>


2022-09-30 21:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.