blogger
  • css-position
  • addthis
  • 2013-02-23 27 views -1 likes 
    -1

    我有一個問題,使我的歡迎欄固定,而滾動通過 my blog。我想在滾動過程中將該AddThis條固定在頂部邊緣。這是代碼:製作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

    要固定你可以指定參數「固定」,並將其設置爲true頁的頂部欄,所以總是使杆固定的一個例子是:

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

    並且在「默認」對象內,您也可以指定「showOnScrollTo」參數。

    +0

    非常感謝,它工作!如果你可以告訴我如何在博客的「本地」欄下創建它,並且我將成爲最幸福的人還活着(: – Casper 2013-02-27 21:49:16

    +0

    我還沒有嘗試,所以我不知道這是否會起作用,但你可以嘗試改變使用CSS的酒吧的位置。有一個酒吧的類「addthis_bar_container」,你可以移動它的位置來抵消Blogger的酒吧。試試 – Sol 2013-02-28 12:42:21

    +0

    我嘗試了兩個類和ID - S。Didn'工作..沒關係,感謝您的解決:) – Casper 2013-03-01 10:46:43

    相關問題