What to use instead toggle?

前端 未结 1 933
情书的邮戳
情书的邮戳 2020-12-21 10:46

I learned that function toggle() is deprecated. So what can i use instead toggle for this example:

相关标签:
1条回答
  • 2020-12-21 11:39

    You can use click and slideToggle method.

    $("#click").click(function(){
         var $block = $("#block"),
             $this = $(this);
         $block.slideToggle(function(){
             $this.text($block.is(':visible') ? 'hide' : 'show');
         });
    });
    
    0 讨论(0)
提交回复
热议问题