@@ -144,16 +144,12 @@ function loadJSON(): void {
144144 mouseButton . appendTo ( '#mouse' ) ;
145145 touchButton . appendTo ( '#touch' ) ;
146146 mouseButton . element . onclick = ( ) => {
147- document . body . classList . remove ( 'e-bigger' ) ;
148- mouseButton . element . classList . add ( 'active' ) ;
149- touchButton . element . classList . remove ( 'active' ) ;
150- dispatchResize ( ) ;
147+ localStorage . setItem ( 'ej2-switch' , 'M' ) ;
148+ location . reload ( ) ;
151149 } ;
152150 touchButton . element . onclick = ( ) => {
153- document . body . classList . add ( 'e-bigger' , 'active' ) ;
154- touchButton . element . classList . add ( 'active' ) ;
155- mouseButton . element . classList . remove ( 'active' ) ;
156- dispatchResize ( ) ;
151+ localStorage . setItem ( 'ej2-switch' , 'T' ) ;
152+ location . reload ( ) ;
157153 } ;
158154 if ( Browser . info . name === 'chrome' && Browser . isDevice ) {
159155 let htmlScrollElement : HTMLElement = document . getElementById ( 'html-tab-scroll' ) ;
@@ -185,6 +181,19 @@ function loadJSON(): void {
185181 hasher . changed . add ( parseHash ) ;
186182 hasher . init ( ) ;
187183 wireEvents ( ) ;
184+ let mouseOrTouch : string = localStorage . getItem ( 'ej2-switch' ) ;
185+ if ( mouseOrTouch ) {
186+ if ( mouseOrTouch === 'M' ) {
187+ document . body . classList . remove ( 'e-bigger' ) ;
188+ mouseButton . element . classList . add ( 'active' ) ;
189+ touchButton . element . classList . remove ( 'active' ) ;
190+ } else {
191+ document . body . classList . add ( 'e-bigger' , 'active' ) ;
192+ touchButton . element . classList . add ( 'active' ) ;
193+ mouseButton . element . classList . remove ( 'active' ) ;
194+ }
195+ }
196+ localStorage . removeItem ( 'ej2-switch' ) ;
188197 setResponsive ( ) ;
189198}
190199
0 commit comments