开发者社区 问答 正文

toggle回调函数无效 - 服务报错

$(".detail").live("click",function(){
                var index = $(this).attr("index");
                $(".details[rel='"+index+"']").toggle(function(){
                    $(".detail").html("收起详情");
                },function(){
                    $(".detail").html("查看详情");
                });
            });
toggle回调函数无效  求解答

展开
收起
montos 2020-05-29 21:13:27 534 分享 版权
1 条回答
写回答
取消 提交回答
  • toggle没有 inFunction,outFunction的。。。即没有hover那种写法。######回复 @白与黑 : 看手册,http://api.jquery.com/toggle/ callback是单函数,你现在是hover的In和Out写法。######toggle有回调函数呀######你到底要click谁?  .detail or .details[rel='"+index+"']。上html######回复 @白与黑 :那你写的明显不对。toggle应该在detail上######点击detail 将details展开或收起

    2020-05-29 21:13:36
    赞同 展开评论
问答地址: