小编Eug*_*min的帖子

动态添加Google plus +1按钮和IE8问题

是否有任何方法可以动态添加Google + +1按钮?我需要这个,因为一个页面有许多URL要分享,他们是通过AJAX获得的.所以,当我需要URL时,我想在页面的某些位置生成"+1"-s.

我编写的测试代码适用于IE8以外的所有浏览器(谷歌根本不支持IE7):

<div class="googlePlusBtn"></div>
<a href="#" class="addGooglePlus">Click me!</a>
Run Code Online (Sandbox Code Playgroud)
<script type="text/javascript">
jQuery(function(){
    jQuery('.googlePlusBtn').html('<g:plusone annotation="inline"></g:plusone>');
    jQuery('a.addGooglePlus').click(function()
    {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/plusone.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
        return false;
    })
})
</script>
Run Code Online (Sandbox Code Playgroud)

请你帮助我好吗?

UPD:固定.解决方案如下:

<div id="googlePlusBtn"></div>
<a href="#" class="addGooglePlus">Click me!</a>
Run Code Online (Sandbox Code Playgroud)
<script type="text/javascript">
jQuery(function(){
            var po = document.createElement('g:plusone');
            var s = document.getElementById('googlePlusBtn');
        s.appendChild(po);
    jQuery('a.addGooglePlus').click(function()
    {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/plusone.js';
        var s = …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery google-plus-one

7
推荐指数
1
解决办法
4825
查看次数

在 Internet Explorer 中包含 100% 宽度图像的 flex 子框的高度不正确

我使用Chris 的 Coyer 方法使页脚粘在页面底部。

HTML

<div class="container">
  <div class="content-box">
    <div class="image-box">
      <img src="https://i.stack.imgur.com/XIQ2T.jpg">
    </div>
  </div>
  <div class="bottom-box">Bottom</div>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.container {
  display: flex;
  flex-direction: column;
  height: 100vh; /* Avoid the IE 10-11 `min-height` bug. */
}
.bottom-box {
  flex-shrink: 0; /* Prevent Chrome, Opera, and Safari from letting these items shrink to smaller than their content's default minimum size. */  
  background: #069;
  color: #fff;
  line-height: 3;
}
.content-box {
  flex: 1 0 auto; /* Prevent Chrome, Opera, and …
Run Code Online (Sandbox Code Playgroud)

html css flexbox internet-explorer-11

5
推荐指数
1
解决办法
1194
查看次数