你好我試圖自動化內容從文本共享此鏈接此內容...自動創建份額從第
有每一頁上的20個職位,將需要鏈接,即爲什麼我做了# tweet01
這是我的存根,但我認爲我錯過了一些東西,任何幫助非常感謝,在此先感謝!
<p id="tweet01">When I was 10 I started washing cars. I then offered to clear paths for those without cars. I soon made money from most houses on my street.</p>
<div class="stream-item-footer">
<ul class="tweet-actions">
<script type="text/javascript">
var tweet = $("#tweet01").text()
var shortTweet = $("#tweet01").text() // get the text within the div
.trim() // remove leading and trailing spaces
.substring(0, 100) // get first 100 characters
.split(" ") // separate characters into an array of words
.slice(0, -1) // remove the last full or partial word
.join(" ") + "..."; // combine into a single string and append "..."
$(document).ready(function() {
$().html('<li><span class="st_twitter" st_url="http://www.domain.com" st_title="'+ ++shortTweet +'"></span></li>');
$().html('<li><span class="st_linkedin" st_url="http://www.domain.com" st_title="'+ ++tweet +'" st_summary="'+ ++tweet +'"></span></li>');
$().html('<li><span class="st_facebook" st_url="http://www.domain.com" st_title="'+ ++tweet +'" st_summary="'+ ++tweet +'"></span></li>');
$().html('<li><span class="st_googleplus" st_url="http://www.domain.com" st_title="'+ ++tweet +'" st_summary="'+ ++tweet +'"></span></li>');
});
</script>
</ul>
</div>
有什麼問題嗎? – tymeJV 2013-04-22 15:02:18
'$()。html('');'什麼都不做。 '$()'什麼也不選,所以這就是返回的結果。 – 2013-04-22 15:08:34
只是一些建議,而不是在每條推文後放這段代碼,只寫一次這段代碼。給每個推文同一個類,然後執行'$('。tweet')。each(function(){// ...});'。 – 2013-04-22 15:10:50