2007-06-18按钮将不可里面AJAX工作,但会正常工作 [英] AddThis button will not work inside AJAX, but will work normally

查看:110
本文介绍了2007-06-18按钮将不可里面AJAX工作,但会正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,这是我在做什么。 用户访问网站,加载的index.html 在index.html的,它会自动加载,通过AJAX,details.html变成了DIV。 我把details.html的前页按钮。然而,由于某些原因,翻车不起作用。

当我访问details.html在浏览器,翻车的作品。我猜这是因为AJAX的?

 <一类=addthis_button的href =htt​​p://www.addthis.com/bookmark.php?v=250&pub=xa-4adf7e45288f5b21&GT ;
< IMG SRC =htt​​p://s7.addthis.com/static/btn/sm-share-en.gifWIDTH =83高度=16ALT =书签和共享的风格=边界: 0;的margin-top:16px的;/>< / A>
<脚本类型=文/ JavaScript的SRC =htt​​p://s7.addthis.com/js/250/addthis_widget.js#pub=xa-4adf7e45288f5b21>< / SCRIPT>
 

解决方案

如果我正确理解你的问题,在AJAX功能的回调,结合翻车到加载该按钮。

  $。阿贾克斯({
   键入:POST,
   网址:some.php
   数据:名称=约翰和放大器;位置=波士顿,
   成功:函数(){
     $('。addthis_button)。悬停(
       功能(){
         //做鼠标
       },功能(){
         //做鼠标移出
     });
   }
 });
 

您也可以尝试

  $('。addthis_button)生活(鼠标悬停,函数(){//做鼠标悬停});
$('。addthis_button)生活('的mouseout',函数(){//做的mouseout});
 

我从未使用过现场,但看起来它会为你工作,因为你add_this按钮的的$(文件)后,获得创建。就绪()

Basically, this is what I'm doing. User visits site, loads "index.html" Within index.html, it automatically loads, through AJAX, "details.html" into a DIV. I put an ADDTHIS button on "details.html". However, for some reason , the roll-over doesn't work.

When I visit details.html in the browser, the roll-over works. I'm guessing it's because of the AJAX?

<a class="addthis_button"  href="http://www.addthis.com/bookmark.php?v=250&amp;pub=xa-4adf7e45288f5b21">
<img src="http://s7.addthis.com/static/btn/sm-share-en.gif" width="83" height="16" alt="Bookmark and Share" style="border:0;margin-top:16px;"/></a>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pub=xa-4adf7e45288f5b21"></script>

解决方案

if i understand your question correctly, in the callback of the ajax function, bind the roll-over to the add-this button.

 $.ajax({
   type: "POST",
   url: "some.php",
   data: "name=John&location=Boston",
   success: function(){
     $('.addthis_button').hover(
       function(){
         //do mouse over
       },function(){
         //do mouse out
     });
   }
 });

you can also try

$('.addthis_button').live('mouseover',function(){//do mouseover});
$('.addthis_button').live('mouseout',function(){//do mouseout});

i've never used live, but it seems like it would work for you since your add_this button's get created after the $(document).ready()

这篇关于2007-06-18按钮将不可里面AJAX工作,但会正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆