【问题标题】:G+1 button during loading ads scrollbar to my site将广告滚动条加载到我的网站期间的 G+1 按钮
【发布时间】:2014-01-31 23:39:59
【问题描述】:
我的网站有一个主 div,其宽度设置为 ~1200px 并居中。
如果我将 g+1 按钮放在另一个 div 中,它是 float:left 和 div,内容在右侧,一切都很好。可悲的是,我想把这个按钮放在我内容的右侧。在这种情况下,在加载此按钮时,广告水平滚动条会持续一秒钟。
我知道这件事:google +1 button adds scroll bar to my site
但这对我不起作用。
我在谷歌上搜索,但每个解决方案都与我上面链接的类似。
[编辑] 仅限 IE 和 FF
【问题讨论】:
标签:
css
html
layout
google-plus-one
【解决方案1】:
我发现只有一个解决方案是将 g+1 按钮加载到隐藏的 div,并延迟显示此 div。
Social div 包含三个 social-* div,分别用于 facebook、googleplus 和 twitter。
$('#social-fb').css("opacity", "0.0");
$('#social-gp').hide();
$('#social-tw').hide();
$('#social-fb').html('...');
$('#social-gp').html('...');
$('#social-tw').html('...');
timeoutID = setTimeout(function(){
$('#social').hide()
$('#social-fb').css("opacity", "1.0");
$('#social-gp').show();
$('#social-tw').show();
$('#social').fadeIn(500);
}, 2000);