0

I have an array of numbers and currentValue array values dynamically changes if same values animate ( fade-in and fade-out ) the Tooltipclass elements but its not working.
check currentValue array then get the same value index if i get index 0 and 3 are same value and animate the Tooltipclass index 0 and 3 element.
JS:

eg: var currentValue = [3,5,3];
    // index 0 and 2 same values 

    var Tooltipclass = ['.helpertool_1','.helpertool_2','.helpertool_3'];
    // class index 0 and 2 ll animate

JS:

function getSamevalue(values){
    var currentValue = [3,5,3]; //[values] dynamically values ll change
    var Tooltipclass = ['.helpertool_1','.helpertool_2','.helpertool_3'];
        $.each(Tooltipclass, function(i, val) {
              setTimeout(function() {
                  $(Tooltipclass[i]).fadeOut("slow", function() {
                      $(this).fadeIn("slow");
                  });
              }, i * 3000);
         });
}

getSamevalue(values);

CSS:

.tooltip{ background: red;position:absolute; width:50px; height:20px; }

JSFIDDLE

Spartans
  • 1
  • 1
  • 4
  • 1. In your JSFiddle include jQuery 2. You need to pass values too the parameter since values is not defined. Then some people can help. – Riddell May 04 '16 at 11:14
  • 1
    Something like this https://fiddle.jshell.net/42y08384/4/ ?? – Pugazh May 04 '16 at 11:18
  • Its not continuous looping and currentValue = [3,5,3] index 0 and 2 value only same so we can animate .helpertool_1 and .helpertool_3 – Spartans May 04 '16 at 11:23
  • 1
    you should use `setInterval` for infinite looping – RRR May 04 '16 at 11:26
  • please refer http://jsfiddle.net/Q6kp3/ – RRR May 04 '16 at 11:30
  • Possible duplicate of [JavaScript Infinite Loop?](http://stackoverflow.com/questions/5835126/javascript-infinite-loop) – Francisco Romero May 04 '16 at 11:32
  • @RRR its working fine but sometimes 2 or 3 list appear at same time. Then how to compare currentValue = [3,5,3]; and Tooltipclass = ['.helpertool_1','.helpertool_2','.helpertool_3']; – Spartans May 04 '16 at 13:26

0 Answers0