@@ -12,11 +12,12 @@ define([
1212
1313 // Extends Backbone.Router
1414 var CategoryRouter = Backbone . Router . extend ( {
15+ backToHome : false ,
1516
1617 // The Router constructor
1718 initialize : function ( ) {
1819
19- this . pagecontainer = $ ( ".ui-pagecontainer" ) . pagecontainer ( "instance " ) ;
20+ this . pagecontainerHandle = $ ( ".ui-pagecontainer" ) ;
2021
2122 // Instantiates a new Animal Category View
2223 this . animalsView = new CategoryView ( { el : "#animals" , collection : new CategoriesCollection ( [ ] , { type : "animals" } ) } ) ;
@@ -27,9 +28,9 @@ define([
2728 // Instantiates a new Vehicles Category View
2829 this . vehiclesView = new CategoryView ( { el : "#vehicles" , collection : new CategoriesCollection ( [ ] , { type : "vehicles" } ) } ) ;
2930
31+
3032 // Tells Backbone to start watching for hashchange events
3133 Backbone . history . start ( ) ;
32-
3334 } ,
3435
3536 // Backbone.js Routes
@@ -47,21 +48,21 @@ define([
4748 home : function ( ) {
4849
4950 // Programatically changes to the categories page
50- this . pagecontainer . change ( "#categories" , {
51+ this . pagecontainerHandle . pagecontainer ( "change" , "#categories" , {
5152 reverse : false ,
52- changeHash : false
53+ changeUrl : false
5354 } ) ;
54-
5555 } ,
5656
5757 // Category method that passes in the type that is appended to the url hash
5858 category : function ( type ) {
5959
6060 // Stores the current Category View inside of the currentView variable
6161 var currentView = this [ type + "View" ] ;
62+ var that = this ;
6263
6364 // If there are no collections in the current Category View
64- if ( ! currentView . collection . length ) {
65+ if ( ! currentView . collection . length ) {
6566
6667 // Show's the jQuery Mobile loading icon
6768 $ . mobile . loading ( "show" ) ;
@@ -70,9 +71,9 @@ define([
7071 currentView . collection . fetch ( ) . done ( function ( ) {
7172
7273 // Programatically changes to the current categories page
73- this . pagecontainer . change ( "#" + type , {
74+ that . pagecontainerHandle . pagecontainer ( "change" , "#" + type , {
7475 reverse : false ,
75- changeHash : false
76+ changeUrl : false
7677 } ) ;
7778 } ) ;
7879
@@ -82,9 +83,9 @@ define([
8283 else {
8384
8485 // Programatically changes to the current categories page
85- this . pagecontainer . change ( "#" + type , {
86+ this . pagecontainerHandle . pagecontainer ( "change" , "#" + type , {
8687 reverse : false ,
87- changeHash : false
88+ changeUrl : false
8889 } ) ;
8990
9091 }
0 commit comments