使AddThis欢迎栏得到修复

时间:2013-02-23 19:59:12

标签: blogger css-position addthis

滚动时我的欢迎栏已修复,我遇到了问题 my blog。我想在滚动期间将AddThis'栏固定在顶部边缘。这是代码:

<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-510063517c175536"></script>
<script type='text/javascript'>
addthis.bar.initialize({'default':{
    "backgroundColor": "#EDEDED",
    "buttonColor": "#3CA8FA",
    "textColor": "#FFA733",
    "buttonTextColor": "#FAFAFA"
},rules:[
    {
        "name": "AnyOther",
        "message": "If you enjoy this page, do me a favor:",
        "action": {
            "type": "button",
            "text": "Share this page",
            "verb": "share",
            "service": "preferred"
        }
    },
    {
        "name": "Twitter",
        "match": {
            "referringService": "twitter"
        },
        "message": "If you find this page helpful:",
        "action": {
            "type": "button",
            "text": "Tweet it!",
            "verb": "share",
            "service": "twitter"
        }
    },
    {
        "name": "Facebook",
        "match": {
            "referringService": "facebook"
    },
    "message": "Tell your friends about me:",
    "action": {
        "type": "button",
        "text": "Share on Facebook",
        "verb": "share",
        "service": "facebook"
    }
},
{
    "name": "Google",
    "match": {
        "referrer": "google.com"
    },
    "message": "If you like my blog, let Google know:",
    "action": {
        "type": "button",
        "text": "+1",
        "verb": "share",
        "service": "google_plusone_share"
        }
    }
]});
</script>

有一个名为showOnScrollTo的参数(你可以找到关于它的解释here),但我不知道如何或在何处使用它。我试过把CSS“位置:固定;”在这段代码中的几个地方,但它没有用。如果有人有想法,请帮忙。提前致谢

1 个答案:

答案 0 :(得分:1)

要使栏固定在页面顶部,您可以指定参数“fixed”并将其设置为true,因此始终固定栏的示例是:

<script type='text/javascript'>
    addthis.bar.initialize({'default':{
        fixed: true,
        showOnScrollTo: [element | string | integer | float]
        });
</script>

在“默认”对象中也可以指定“showOnScrollTo”参数。