jquery - JavaScript function syntax error in Internet Explorer 10 + 11 -




i'm using script display/hide divs. works in browsers except internet explorer 10+11. syntax error in line: const show = () =>".

the code this:

function cycle(info) {   let = 0,     blocks = object.keys(info);   const show = () =>     $("#" + blocks[i % blocks.length])     .fadein(300)     .delay(info[blocks[i++ % blocks.length]])     .fadeout(300, show);   show(); }  //run cycle({   block2: 7000,   block3: 3000 }); 

jsfiddle here.

can fixed works in ie10+11 too?

here working example (tested on ie 11)

function cycle(info) {    let = 0,      blocks = object.keys(info);    const show = function() {      $("#" + blocks[i % blocks.length])        .fadein(300)        .delay(info[blocks[i++ % blocks.length]])        .fadeout(300, show);    }    show();  }    cycle({    block2: 7000,    block3: 3000  });
#block2,  #block3 {    display: none;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <div id="block2">    <div>block 2</div>  </div>  <div id="block3">    <div>block 3</div>  </div>

the problem had way defining const show. assuming ie doesn't recognise way, simplest fix change normal way, i.e smth = function(){}. fixed issue.

hope helps!





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -