Facebook Like buttons not displaying when loaded hidden

前端 未结 10 2129
梦毁少年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条回答
  •  Happy的楠姐
    2020-12-15 04:25

    Setting opacity to 0 is not a solution for me because it hides and overlaps anything you need to click-on and also jquery fadein function uses the css display property not opacity.

    so the solution i've came up with is to display the container as block but out of the window left:-9999px, then i set a timer for 1s~2s (time needed for all social buttons to render) and change display to none and back to the original position :

    #bnts_container
    {
      left:-9999px;
      display:block;
    }
    
    $(window).load(function () {
    
      setTimeout(function () {
         $('#bnts_container').css("display", "none");
         $('#bnts_container').css("left", "50%");
        } , 2000);
    
    });
    

    Click on the +Share button here to test this solution.

提交回复
热议问题