How to continue event propagation after cancelling?

前端 未结 8 694
孤街浪徒
孤街浪徒 2020-12-13 11:41

When a user clicks a certain link I would like to present them with a confirmation dialog. If they click \"Yes\" I would like to continue the original navigation. One catch:

8条回答
  •  北海茫月
    2020-12-13 12:45

    If I am understanding the problem correctly, I think you can just update the event to be the original event in that closure you have there. So just set e = e.originalEvent in the .done function.

    https://jsfiddle.net/oyetxu54/

    MyApp.confirm("confirmation?")
    .done(function(){ e = e.originalEvent;})
    

    here is a fiddle with a different example (keep the console open so you can see the messages): this worked for me in chrome and firefox

提交回复
热议问题