简体   繁体   English

Sharethis不会加载AJAX

[英]Sharethis doesn't load with AJAX

I am using jquery infinity scroll and jquery masonry plugin on one my projects and also I an using a Sharethis buttons on the pages. 我在我的一个项目中使用jquery infinity scroll和jquery masonry插件,并且我在页面上使用Sharethis按钮。

problem is that the Sharethis button dosen't load on the 2nd page, which is loaded using ajax. 问题是Sharethis按钮没有加载到使用ajax加载的第二页上。 I am using normal Sharethis code 我正在使用普通的Sharethis代码

<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "ur-de6b7a4a-e967-4778-5476-54ab547cb1bb", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>


<span class='st_facebook_hcount' st_url="http://<?php echo $settings['siteurl'];?>/listing-<?php echo $row['id'];?>-<?php echo $PageLink;?>.html" st_title="<?php echo $LongTitle;?>" displayText='Facebook'></span>
<span class='st_twitter_hcount' st_url="http://<?php echo $settings['siteurl'];?>/listing-<?php echo $row['id'];?>-<?php echo $PageLink;?>.html" st_title="<?php echo $LongTitle;?>" displayText='Tweet'></span>
<span class='st_pinterest_hcount' st_url="http://<?php echo $settings['siteurl'];?>/listing-<?php echo $row['id'];?>-<?php echo $PageLink;?>.html" st_title="<?php echo $LongTitle;?>" displayText='Pinterest'></span>

Can anyone tell me a fix for this? 谁能告诉我这个问题? did search everywhere but couldn't find an answer. 到处搜索但找不到答案。

I just found out that you can use stButtons.locateElements(); 我刚刚发现你可以使用stButtons.locateElements(); fix this this problem. 解决这个问题。 thank everyone for your time. 谢谢大家的时间。

I was facing the same problem with sharethis and Ajax pagination. 我在sharethis和Ajax分页方面遇到了同样的问题。 The buttons was not showing after posts loaded by Ajax so I've searched and found this. 在Ajax加载的帖子之后没有显示按钮,所以我搜索并找到了这个。 I've just added the function stButtons.locateElements(); 我刚刚添加了函数stButtons.locateElements(); on Ajax success: 关于Ajax的成功:

something like success: stButtons.locateElements(); success: stButtons.locateElements();东西success: stButtons.locateElements();

Hope this will be helpful for someone like me. 希望这对像我这样的人有所帮助。

Thanks 谢谢

Ibnul Ibnul

Call this function on Ajax success 在Ajax上成功调用此函数

stButtons.locateElements(); stButtons.locateElements();

ie: 即:

success: function (response) {
  .............
  Your Code
  .............
  stButtons.locateElements();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM