-1

I have a problem making my welcome bar fixed while scrolling through my blog. I would like to make that AddThis' bar fixed on top edge during scroll. This is the code:

<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>

There is a parameter called showOnScrollTo (you can find the explanation about it here), but I don't know how or where to use it. I tried putting the CSS "position: fixed;" on several places inside this code, but it didn't work. If anyone has an idea, please help. Thanks in advance

1 Answer 1

1

To make the bar fixed at the top of the page you can specify the parameter "fixed" and set it to true, so an example of always making the bar fixed is:

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

And within the "default" object is also where you would specify the "showOnScrollTo" parameter.

3
  • Thank you very much, it worked! If you could just tell me how to make it underneath the blogger's "native" bar and I would be the happiest man alive (:
    – Aleksandar
    Feb 27, 2013 at 21:49
  • I haven't tried, so I don't know if this will work or not, but you could try to change the position of the bar using CSS. There's a class for the bar "addthis_bar_container" where you could move it's position to offset the Blogger's bar. Give that a try.
    – Sol
    Feb 28, 2013 at 12:42
  • I tried with both classes and id-s. Didn't work.. never mind, thanks for fixing :)
    – Aleksandar
    Mar 1, 2013 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.