R – sIFR onReplacement example

sifr

Can someone show me the proper way to invoke the onReplacement callback within sIFR.replace?

Here's my current sIFR.replace method call:

sIFR.replace(mainNavFont, {
  selector: 'a.nav-item',
  css: '.sIFR-root { color: #ffffff; cursor:pointer;}',
  wmode:'transparent',
  fitExactly: true,
  tuneWidth:10,
  offsetLeft: 5,
  forceSingleLine: true
});

Best Answer

Like this:

sIFR.replace(mainNavFont, {
  selector: 'a.nav-item',
  css: '.sIFR-root { color: #ffffff; cursor:pointer;}',
  wmode:'transparent',
  fitExactly: true,
  tuneWidth:10,
  offsetLeft: 5,
  forceSingleLine: true,
  onReplacement: function(fi) {
    // Movie has been replaced
  }
});

Also, you'll find that replacing the <a> directly will break the links in most browsers. You have to replace the parent element such that the link ends up inside the Flash movie.