Software Archive
Read-only legacy content
17061 Discussions

jqm_subpage trigger event pagechange on $(document) not $(sel)

tetsuya
Beginner
312 Views

Hi,

I've tried to create new mobile application with App Designer and I selected jQuery Mobile.

When I use subpage, xdk/ad/jqm_subpage.js is added to my project by XDK.
It seems to trigger event "pagechange" in subpage navigation, but it triggered on $(document) and no other arguments.
So, I can't use that event to handle subpage navigation.

I think it should be triggered on $(sel) instead.
How about that?

(edited after posted)
I'd like to propose following modification so that I can handle subpage navigations.

*** jqm_subpage.js_orig	Wed Feb 23 14:42:36 2016
--- jqm_subpage.js	Wed Feb 24 12:28:08 2016
***************
*** 11,17 ****
      var parent_vis = $(parent_sel).is(":visible");
      if(parent_vis)
      {
-         $(document).trigger("pagechange");
          if(!have_state){ window.history.pushState({usubpage:sel}, sel, document.location.origin + document.location.pathname + "#" +sel); }
      }
      else
--- 11,16 ----
***************
*** 20,25 ****
--- 19,25 ----
          $.mobile.changePage(parent_sel);
          window.history.replaceState({usubpage:sel}, sel, document.location.origin + document.location.pathname + "#" + sel);
      }
+     $dn.trigger("pagechange");
  }
  
  

 

Regards,
--
tetsuya

0 Kudos
2 Replies
PaulF_IntelCorp
Employee
312 Views

I will forward your suggestion to the engineer in charge.

0 Kudos
Markus_G_1
Beginner
312 Views

+1 for this as it makes things work as implicated by JQM.

Right now the 'pagechange' event for subpages work as a 'pageleave' event.

0 Kudos
Reply