我正在使用 Gigya 的 javascript API 来设置社交分享栏,但需要自定义图标。似乎showShareBarUI不允许 facebook/twitter/等。要更改的图标,但它确实允许用户预览他们将发布的帖子。相反,publishUserAction将允许自定义图标在登录时发布,但不提供用户内容的任何预览。
有没有办法在使用 Gigya 时为共享栏设置自定义图标并预览帖子内容?
我正在尝试两者:
var act = new gigya.socialize.UserAction();
act.setTitle("This is my title"); // Setting the Title
act.setLinkBack("http://www.gigya.com"); // Setting the Link Back
act.setDescription("This is my Description"); // Setting Description
act.addActionLink("Read More", "http://www.gigya.com"); // Adding Action Link
var params =
{
userAction:act,
shareButtons:[
{ // Twitter Tweet button
provider:'twitter-tweet',
tooltip:'Share on Twitter',
defaultText:'Twitter message'
},
{ // Google +1 button
provider:'google-plusone',
tooltip:'Recommend this on Google',
userMessage:'default user message'
}
],
showCounts:'none',
containerID:'shareBar'
}
gigya.socialize.showShareBarUI(params);
或者 -
function twitterLogin() {
gigya.services.socialize.login({provider:'twitter',callback:twitter});
}
function twitter(){
var act = new gigya.socialize.UserAction();
act.setTitle("This is my title"); // Setting the Title
act.setLinkBack("http://www.gigya.com"); // Setting the Link Back
act.setDescription("This is my Description"); // Setting Description
act.addActionLink("Read More", "http://www.gigya.com"); // Adding Action Link
var params =
{
userAction:act,
enabledProviders:"twitter"
};
// Publishing the User Action
gigya.socialize.publishUserAction(params);
}
HTML -
<div id="shareBar" >
<a href="#" onclick="javascript:twitterLogin()">
<img src="images/custom-twitter-icon.png" />
</a>
</div>