@@ -26,10 +26,6 @@ $.widget( "ui.accordion", {
26
26
icons : {
27
27
header : "ui-icon-triangle-1-e" ,
28
28
headerSelected : "ui-icon-triangle-1-s"
29
- } ,
30
- navigation : false ,
31
- navigationFilter : function ( ) {
32
- return this . href . toLowerCase ( ) === location . href . toLowerCase ( ) ;
33
29
}
34
30
} ,
35
31
@@ -77,20 +73,6 @@ $.widget( "ui.accordion", {
77
73
. addClass ( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) ;
78
74
self . headers . find ( ":first-child" ) . addClass ( "ui-accordion-heading" ) ;
79
75
80
- if ( options . navigation ) {
81
- var current = self . element . find ( "a" ) . filter ( options . navigationFilter ) . eq ( 0 ) ;
82
- if ( current . length ) {
83
- var header = current . closest ( ".ui-accordion-header" ) ;
84
- if ( header . length ) {
85
- // anchor within header
86
- self . active = header ;
87
- } else {
88
- // anchor within content
89
- self . active = current . closest ( ".ui-accordion-content" ) . prev ( ) ;
90
- }
91
- }
92
- }
93
-
94
76
self . active = self . _findActive ( self . active || options . active )
95
77
. addClass ( "ui-state-default ui-state-active" )
96
78
. toggleClass ( "ui-corner-all" )
@@ -598,4 +580,40 @@ $.extend( $.ui.accordion, {
598
580
}
599
581
} ) ;
600
582
583
+
584
+
585
+ // DEPRECATED
586
+
587
+ // navigation options
588
+ ( function ( $ , prototype ) {
589
+ $ . extend ( prototype . options , {
590
+ navigation : false ,
591
+ navigationFilter : function ( ) {
592
+ return this . href . toLowerCase ( ) === location . href . toLowerCase ( ) ;
593
+ }
594
+ } ) ;
595
+
596
+ var _create = prototype . _create ;
597
+ prototype . _create = function ( ) {
598
+ if ( this . options . navigation ) {
599
+ var self = this ,
600
+ headers = this . element . find ( this . options . header ) ,
601
+ content = headers . next ( ) ;
602
+ current = headers . add ( content )
603
+ . find ( "a" )
604
+ . filter ( this . options . navigationFilter )
605
+ [ 0 ] ;
606
+ if ( current ) {
607
+ headers . add ( content ) . each ( function ( index ) {
608
+ if ( $ . contains ( this , current ) ) {
609
+ self . options . active = Math . floor ( index / 2 ) ;
610
+ return false ;
611
+ }
612
+ } ) ;
613
+ }
614
+ }
615
+ _create . call ( this ) ;
616
+ } ;
617
+ } ( jQuery , jQuery . ui . accordion . prototype ) ) ;
618
+
601
619
} ) ( jQuery ) ;
0 commit comments