前页不工作与阿贾克斯 [英] Addthis not working with Ajax
问题描述
我加载与阿贾克斯的所有文章,但前页的功能是不正确的。
I am loading all articles with Ajax but Addthis functionality is not correct
$thisChild.load( permLink + ' #thePostStuff', function() {
在前述.load()函数,我已经添加了这code,使在前页共享功能的回调:
And in the callback of said .load() function, I've added this code to bring in the Addthis share functionality:
var script = 'http://s7.addthis.com/js/300/addthis_widget.js?domready=1#pubid=MY-PUB-ID';
if (window.addthis){
window.addthis = null;
}
$.getScript( script );
调用加载的前页脚本Ajax请求的permLink文件的内容中的code是如下:
The code within the content of the permLink file called by the ajax request that loads the Addthis script is as follows:
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style addthis_32x32_style"
addthis:url="<?php the_permalink(); ?>"
addthis:title="<?php the_title(); ?>"
addthis:description="<?php the_excerpt(); ?>">
<a class="addthis_button_facebook"></a>
<a class="addthis_button_twitter"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
<!-- AddThis Button END -->
现在的问题是,前页不加载预期。它的工作原理在第一时间的文章被打开,但是任何其他时间(除非该页面刷新),其中没有显示多少次文章共享的数量,这似乎是这样,当我检查元素:&LT;一类=addthis_button_expanded目标=_空白标题=查看更多服务的href =#&GT; 1&LT; / A&GT;
编辑:
尝试一个已知的修正: $ getScript加入脚本(脚本函数(){addthis.init();});
但这并没有解决这个问题
Attempted a known fix: $.getScript( script , function() { addthis.init(); });
but this did not solve the problem.
编辑2012年8月14日
EDIT August 14, 2012
该网站是 http://epicvan.com ,我只是删除了的数字,因为我从来没有想出了一个补丁,而我工作它。该项目已于几个月前,我不会测试新的答案。希望他们能帮助你,如果你遇到同样的问题!干杯
The website is http://epicvan.com and I just removed the numbers because I never came up with a fix while I was working on it. The project was completed months ago so I won't be testing the new answers. Hope they can help you if you encounter the same problem! Cheers
推荐答案
我有同样的问题。有下列固定它。希望修复它为你。
I had the same problem. Fixed it with the following. Hope that fixes it for you too.
原文:
var script = 'http://s7.addthis.com/js/300/addthis_widget.js?domready=1#pubid=MY-PUB-ID';
if (window.addthis){
window.addthis = null;
}
$.getScript( script );
新:
<script>
var script = 'http://s7.addthis.com/js/250/addthis_widget.js#domready=1';
if (window.addthis) {
window.addthis = null;
window._adr = null;
window._atc = null;
window._atd = null;
window._ate = null;
window._atr = null;
window._atw = null;
}
$.getScript(script);
</script>
这篇关于前页不工作与阿贾克斯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!