2016-01-29 31 views
1

我有我的社交媒體共享代碼的一些問題。社會化媒體分享的具體內容進行

見下面我的代碼:

//我想分享在Facebook上分享按鈕的點擊Facebook的這個div(ID = 「maindiv」)...

<html> 
    <head> 

    </head>  
    <body> 

    <div id="fb-root"></div> 
    <script> 
    (function(d, s, id) { 
     var js, fjs = d.getElementsByTagName(s)[0]; 
     if (d.getElementById(id)) return; 
     js = d.createElement(s); js.id = id; 
     js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=17968886776"; 
     fjs.parentNode.insertBefore(js, fjs); 
    } 
    (document, 'script', 'facebook-jssdk')); 

    </script> 



    <div id="maindiv1" style="border:1px solid blue;width:500px;height:230px">    
     <div style="border:0px solid red;width:100px;height:80px;float:left;"> 
     <img src="http://localhost:8080/pushnotification/img/small-icon.png" /><img> 
     </div> 
     <h1 style="color:blue;font-family:sans-serif;float:left;width:390px;margin-top:10;text-align:center;border:0px solid red;">enterployee.com</h1> 
     <div style="border:0px solid red;width:100%;height:120px;float:left;"> 
     <p style="font-family:sans-serif;font-size:15px;"> 
      Enterployee.com is a employee relationship management tool for enterprise. It’s a fully managed notification platform for employees. 
    We have a vision to make organizations more professional and organized. After getting an enterployee account organizations can notify their employees easily and employees can connect with their company in better way. 
      </p> 

     </div> 

     <div style="border:0px solid red;width:80px;height:30px;float:right;"> 
     <div class="fb-share-button" data-href="http://localhost:8080/pushnotification/img/small-icon.png" data-layout="button"></div> 
     </div> 
    </div>     
</body> 

所以問題是我在我的網站上張貼了多個工作,我需要將此分享按鈕添加到每個單獨的div,而不是整個頁面。我已經完成了完整頁面共享的編碼,但需要幫助共享頁面或div的某些部分。

+0

_「我在我的網站上發佈了多個職位」_ - 理想情況下,您將爲每個職位提供單獨的網址,這些網址只包含該職位的相關數據。然後,您可以將該個人網址分享到Facebook。 – CBroe

+0

OK,顯示每個作業後我應該使用一個URL ... –

回答

0
<div class="fb-share-button" data-href="y" data-layout="our urlherebutton"></div> 


    (function(d, s, id) { 
    var js, fjs = d.getElementsByTagName(s)[0]; 
    if (d.getElementById(id)) return; 
    js = d.createElement(s); js.id = id; 
    js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5"; 
    fjs.parentNode.insertBefore(js, fjs); 
}(document, 'script', 'facebook-jssdk')); 
+1

這是僅適用於的FB分享,但我需要共享特定的區域或頁面索南的DIV –

+0

that's不是一個答案...... – luschn

+0

請你知道#luschn然後告訴我 –