Facebook Like buttons not displaying when loaded hidden

前端 未结 10 2169
梦毁少年i
梦毁少年i 2020-12-15 04:18

I\'m a bit stuck with this one. I have an article list with snippets that link off to the full article. when you hover over each blurb a bar appears at the bottom of the blu

10条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-15 04:25

    We had the same problem and solved it by setting the initial width and height of the containing div to zero with CSS and then, when the trigger is activated, use jQuery to:

    • set opacity to zero (to hide the div while it is expanded)
    • set width and height (expand the div)
    • animate opacity to 1 (fade in the div)

    When fading out, no need to reset the width and height to zero. Just set to display:none after animating opacity to zero. Now that the Facebook button is loaded and has its dimensions set, it's not going to change.

提交回复
热议问题