日期:2014-05-16  浏览次数:20444 次

jquery slideUp的callback如何带参数阿
JScript code


<div id="pa" style="border:#FF0000 1px solid; width:400px; height:700px;">
    <div id="top" style="width:100%">
        <ul style=" margin:0px; padding:0px; list-style:none;">
        <li id="iu">fasdf</li>
        <li>fadfasdf</li>
        <li>fadfasdf</li>
        <li>fadfasdf</li>
        </ul>
    </div>
    
</div>

<script language="javascript">
    $("#top ul li").bind('click',function(event){        
        $('#top').slideUp(1000,function(){此处需要参数的处理,删除li对象});
        
        $('#top').slideDown(1000);
    })
</script>





谁会带参数的callback阿 给个例子 实在不会了 小弟先谢谢了

------解决方案--------------------
HTML code

<script src="http://ajax.Microsoft.com/ajax/jQuery/jquery-1.3.2.min.js" type="text/javascript"> </script> 

<div id="pa" style="border:#FF0000 1px solid; width:400px; height:700px;">
    <div id="top" style="width:100%">
        <ul style=" margin:0px; padding:0px; list-style:none;">
        <li id="iu">fasdf</li>
        <li>fadfasdf</li>
        <li>fadfasdf</li>
        <li>fadfasdf</li>
        </ul>
    </div>
    
</div>

<script language="javascript">
    $("#top ul li").bind('click',function(event){        
        $('#top').slideUp(1000,(function(obj){
            return function(){
                alert(obj.html())
            }
        })($(this)));
//        $('#top').slideDown(1000);
    })
</script>