Wanted functionality : whenever a user taps on the header of the JQuery Mobile application, the content of the main window should scroll to the top.
However when a user taps on an anchor which is located in the header, the default action should be executed (and not the scroll-action).
I already tried following code :
$(document).on('tap', 'div[data-role=header]' ,function(event, ui) {
if (event.target.tagName !== 'A') {
// perform scroll action here
};
});
This works pretty good, except when I tap following anchor in the header :
<a href="#" data-role="button" data-rel="back">Cancel</a>
In this case the default behavior of the anchor is not executed.
Could anyone explain me why ?