google +1 button adds scroll bar to my site

萝らか妹 提交于 2019-12-06 02:44:45

问题


I have had a google +1 button on my site for more then a year and it all worked fine.

In the last couple of days this button started to create a horizontal scroll bar on my site.

I know that beacase when I remove the button the scroll bar disappears.

Here is my site: www.kitchen-guide.co.il

Any suggestions what should I do?

Thanks!


回答1:


borrowing from superware's answer, was having the same problem... however, this worked for me:

iframe[id^="oauth2relay"] { position: fixed !important; }



回答2:


Google's +1 button is adding the following iframe to the end of the page body:

<iframe name="oauth2relayXXXXXXXXX" id="oauth2relayXXXXXXXXX" src="https://accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Fwww.example.com#rpctoken=XXXXXXXXX&amp;forcesecure=1" style="width: 1px; height: 1px; position: absolute; left: -100px;"></iframe>

One workaround (to this Google bug) can be to include the following rule in your CSS:

iframe[id^="oauth2relay"] { left: auto !important; right: -100px !important; }

If your website is all RTL then it should work fine, but if it's also LTR (multilingual) you will have to somehow target that role on RTL pages only. Check resizenow.com.




回答3:


The iframe is no longer used to render the information bubble. therefor, the previously suggested solution will not work anymore.

To fix the issue define the data-onendinteraction callback attribute.

<div class="g-plusone" data-onendinteraction="gplusoneinteraction"></div>

Then, implement the interaction callback function:

window.gplusoneinteraction = function(params) {
    $('iframe[id^="oauth2relay"]').next('div').css({left: 0, right: '-10000px'});
}


来源:https://stackoverflow.com/questions/18437265/google-1-button-adds-scroll-bar-to-my-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!