0
我正在嘗試構建推文彈出鏈接。Twitter鳴叫鏈接不顯示
我的HTML代碼如下
<p class="col-xs-5 col-xs-offset-1" id="custom-tweet-button">
<a class="twitter-share-button shareButton twitter popup" href="http://twitter.com/share?text=My Custom text" data-text="My Custom text" data-count="none" data-url="https://www.google.com">
<img src="32399/images/social/tweet2.png" alt="" />
</a>
</p>
的JavaScript代碼是
$('.popup').click(function(event) {
var width = 575,
height = 400,
left = ($(window).width() - width)/2,
top = ($(window).height() - height)/2,
url = this.href,
opts = 'status=1' +
',width=' + width +
',height=' + height +
',top=' + top +
',left=' + left;
window.open(url, 'twitter', opts);
return false;
});
問題是,當彈出發生,它只是顯示的文本。 來自teh data-url的URL沒有得到顯示。我需要在推文鏈接中顯示URL。
我創建了一個樣本的jsfiddle
正如你可以看到,數據的URL不習慣於如何使用?
嗯是的。但是,添加該twitter代碼片段代碼也會導致我的自定義圖像消失。我可以通過在鏈接中的文字後添加來解決這個問題 –