0

由于新的 jquery 已经发布,许多带有 jquery 的动画都会在 firefox 中出现错误。我正在使用我制作的这段代码,当我只使用remove()它时它也给 Firefox 思想带来了一些问题,但fadeOut它不起作用。这是我的代码

$("#"+d).fadeOut(300,function(){$("#"+d).remove();}); 

谁能建议我一个更好的代码替代方案。jQuery 1.8 兼容。(它适用于chrome,但不适用于firefox)

这是我的完整代码

$(document).on("click", ".glbhn", function (e) {
e.preventDefault();
var d=$(this).attr('id');
var a=$('.gvpgvpxgvp').val();
var nt ='Global';
var info = 'type=' + nt + '&nid=' + d + '&a=' + a;

$.ajax({
   type: "POST",
   url: "example.php",
   data: info,
   success: function(html){
$("#"+d).fadeOut(300,function(){$("#"+d).remove();});   
 totalcounter(a);
   $('.globbl').html(html);
   }
 });
});
4

2 回答 2

0

尝试这个!

var interval = 0;
function myfrnd(){
       if( $("#" + d).css('display','none')){
                $(this).remove();
                clearInterval(interval);
        }
}

$("#"+d).bind('myfrndevt',function(){
            interval = setInterval(function(){
                                      myfrnd();
                                     },1000);
 });

$("#"+d).fadeOut(300,function(){
                        $(this).trigger('myfrndevt');
});
于 2012-09-05T08:10:38.750 回答
0

为我工作(使用 Firefox 14)。你确定你已经包含了 jQuery 脚本(通过link标签)并包含了里面的代码$(document).ready()吗?您还可以安装 Firebug 来查看错误。

或者可能d没有定义变量,或者不存在这样的 id?

于 2012-09-05T08:00:11.243 回答