![](/img/trans.png)
[英]How to share dynamic text content of DIV or SPAN on whatsapp using jquery?
[英]ShareThis with dynamic share content using JQuery
我正在嘗試使用JQuery更改ShareThis按鈕共享的內容:
var services = [
"facebook",
"twitter",
"linkedin",
"email",
"print"
];
for (var i = 0, len = services.length; i < len; i++) {
stWidget.addEntry({
service: services[i],
element: document.getElementById("st_data_" + services[i]),
url: window.location.href,
title: $("#lblPropertyTitle").html(),
type: "large",
text: services[i],
image: $(".carousel .carousel-inner .item[data-slide-number='0'] img").attr("src"),
summary: $("#lblPropertyDescription").html()
});
}
它只是與默認的標題和圖像共享基本URL。 如何更改共享的標題,描述和圖像?
Facebook和Twitter使用OG標簽確定URL的預覽圖像。 您將需要在頁面上定義它們。 為stWidget條目定義image屬性可能僅對電子郵件或打印選項有用。
要為頁面定義打開的圖形信息,請添加這樣的元標記...
<meta property="og:url" content="http://www.nytimes.com/2015/02/19/arts/international/when-great-minds-dont-think-alike.html" />
<meta property="og:type" content="article" />
<meta property="og:title" content="When Great Minds Don’t Think Alike" />
<meta property="og:description" content="How much does culture influence creative thinking?" />
<meta property="og:image" content="http://static01.nyt.com/images/2015/02/19/arts/international/19iht-btnumbers19A/19iht-btnumbers19A-facebookJumbo-v2.jpg" />
您可以使用某些網絡工具來驗證OG標簽。
說明文件:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.