custom font css change renders slowly in chrome

117 views Asked by At

I'm having a really weird issue where I have some markup like the following:

<i id="battery-status-icon" class="icon icon-megaphone-1"></i>

And the css looks like the following:

[class^="icon-"]:before, [class*=" icon-"]:before {
  font-family: "custom_icons";
  font-style: normal;
  font-weight: normal;
  speak: none;

  display: inline-block;
  text-decoration: inherit;
  width: 1em;
  margin-right: .2em;
  text-align: center;
  /* opacity: .8; */

  /* For safety - reset parent styles, that can break glyph codes*/
  font-variant: normal;
  text-transform: none;

  /* fix buttons height, for twitter bootstrap */
  line-height: 1em;

  /* Animation center compensation - margins should be symmetric */
  /* remove if not needed */
  margin-left: .2em;

  /* you can be more comfortable with increased icons size */
  /* font-size: 120%; */

  /* Uncomment for 3D effect */
  /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
}

.icon-megaphone-1:before { content: '\e894'; } /* '' */
.icon-progress-0:before { content: '\e899'; } /* '' */

Now if I was to use jquery to change the icon

$('#battery-status-icon').removeClass('icon-megaphone-1').addClass('icon-progress-0');

Then the rendering of the new icon takes a while, around 10 seconds or so. In firefox and other browsers, it works like a charm. How can we fix this in Chrome?

0

There are 0 answers