2

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 ?

Shaunak D
  • 20,588
  • 10
  • 46
  • 79
Joost
  • 21
  • 1
  • 1
    It seems a problem of "[event bubbling][1]". Please, look at this [previous answer][1] [1]: http://stackoverflow.com/questions/2728252/jquery-stoppropagation-bubble-down – Luca Detomi Mar 27 '14 at 11:14

0 Answers0