Modal pop up fade in on open click and fade out on close

后端 未结 4 1882
梦谈多话
梦谈多话 2021-01-22 18:30

I have a rather simple question for once. I have delete buttons that open modal pop ups to confirm or deny deletion. I would like these modal pop ups to fade in on click and fad

4条回答
  •  余生分开走
    2021-01-22 19:08

    Use .fadeIn() and .fadeOut() on your id parameter ("delAll1") not on this.

    function showModal(id) {
        $("#" + id).fadeIn('slow');
    }
    function hideModal(id) {
        $("#" + id).fadeOut('slow');
    }
    

    By using, $("#" + id) you can select an element by its id, that's "#" + id.

    See it here.

    Note: Change from onLoad to no wrap (head) under framework on the left sidebar to fix the scope issue.

提交回复
热议问题