Using jQuery animate CSS opacity fade and @font-face gives Internet Explorer very ugly font rendering?

前端 未结 7 1090
北荒
北荒 2021-02-09 15:58

I\'m working on a site with HTML/CSS/jQuery that is trying to act like a Flash site. I\'ve had to use @font-face to get the desired font to work. The client wants the fade in of

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-09 16:40

    While waiting for a future version of jQuery, adding this before your script makes sure jQuery removes the filter attribute at the end of any opacity animation. (Via http://dev.jquery.com/ticket/6652)

    This cleared the ugly fonts for me.

    if ($.cssHooks.opacity.set) {
      $.cssHooks.opacity.defaultSet = $.cssHooks.opacity.set
      $.cssHooks.opacity.set = function(elem, value) {
        $.cssHooks.opacity.defaultSet(elem, value)
        if (!elem.style.filter.replace(/\ *(alpha\(opacity=100\))?/, ''))
          elem.style.removeAttribute('filter')
      }
    }
    

提交回复
热议问题