开发者

Jquery Mobile: Can I use stopPropagation in the pagebeforehide handler?

On one of my pages, I want to ask users first whether they want to navigate away. When user answers no, no transition should occur.

I tried this code:

$('#pTakeCardSet').live('pagebef开发者_开发知识库orehide',function(event, ui){
    event.stopPropagation();
});

But it doesn't work. The new page is still loaded.

Does anyone have the same problem?


You may be getting bit by a live event - from : http://api.jquery.com/event.stopPropagation/

Since the .live() method handles events once they have propagated to the top of the document, it is not possible to stop propagation of live events. Similarly, events handled by .delegate() will always propagate to the element to which they are delegated; event handlers on any elements below it will already have been executed by the time the delegated event handler is called.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜