File tree Expand file tree Collapse file tree 2 files changed +20
-15
lines changed Expand file tree Collapse file tree 2 files changed +20
-15
lines changed Original file line number Diff line number Diff line change 378378 kebbi . addEventListener ( 'touchstart' , target ) ;
379379 }
380380
381+ // 處理中間圖片跟隨視窗大小移動位置
382+ window . onresize = function ( ) {
383+ watchChangeSize ( ) ;
384+ }
385+
386+ function watchChangeSize ( ) {
387+ const offsetWidth = document . documentElement . clientWidth ;
388+ if ( offsetWidth ) {
389+ location . reload ( ) ;
390+ }
391+ }
392+
381393} ( ) ;
Original file line number Diff line number Diff line change 379379 }
380380
381381 // 處理中間圖片跟隨視窗大小移動位置
382- function screenRotate ( ) {
383- const kebbi = document . getElementById ( 'svgKebbi' ) ;
384- const circle = document . querySelector ( '.circle' ) ;
385- const ww = content . offsetWidth ;
386- const wh = content . offsetHeight ;
387- const ox = ( ww - kebbi . offsetWidth ) / 2 ;
388- const oy = ( wh * 0.8 - kebbi . offsetHeight ) / 2 ;
389- kebbi . style . left = `${ ox } px` ;
390- kebbi . style . top = `${ oy } px` ;
391- circle . style . width = `${ ww * 0.4 } px` ;
392- circle . style . height = `${ ww * 0.4 } px` ;
393- circle . style . left = `${ ( ww - circle . offsetWidth ) / 2 } px` ;
394- circle . style . top = `${ ( wh * 0.8 - circle . offsetHeight ) / 2 } px` ;
382+ window . onresize = function ( ) {
383+ watchChangeSize ( ) ;
395384 }
396385
397- window . addEventListener ( 'resize' , screenRotate ) ;
398- screenRotate ( ) ;
386+ function watchChangeSize ( ) {
387+ const offsetWidth = document . documentElement . clientWidth ;
388+ if ( offsetWidth ) {
389+ location . reload ( ) ;
390+ }
391+ }
399392
400393} ( ) ;
You can’t perform that action at this time.
0 commit comments