@@ -847,12 +847,14 @@ function initScript() {
847847 // 跳转输入框回车事件
848848 pageJumpInput . addEventListener ( 'keypress' , function ( e ) {
849849 if ( e . key === 'Enter' ) {
850+ e . preventDefault ( ) ; // 禁用默认跳转列行为
850851 goToPageBtn . click ( ) ;
851852 }
852853 } ) ;
853854
854855 pageHeightInput . addEventListener ( 'keypress' , function ( e ) {
855856 if ( e . key === 'Enter' ) {
857+ e . preventDefault ( ) ; // 禁用默认跳转列行为
856858 pageHeightSetBtn . click ( ) ;
857859 }
858860 } ) ;
@@ -878,6 +880,7 @@ function initScript() {
878880 // 翻页模式
879881 switch ( e . key ) {
880882 case 'ArrowLeft' :
883+ e . preventDefault ( ) ; // 禁用默认跳转列行为
881884 if ( currentPage > 0 ) {
882885 showPage ( currentPage - 1 ) ;
883886 } else {
@@ -892,6 +895,7 @@ function initScript() {
892895 case ' ' :
893896 case 'Space' :
894897 case 'ArrowRight' :
898+ e . preventDefault ( ) ; // 禁用默认跳转列行为
895899 if ( currentPage < totalPages - 1 ) {
896900 showPage ( currentPage + 1 ) ;
897901 } else {
@@ -914,6 +918,7 @@ function initScript() {
914918 }
915919 switch ( e . key ) {
916920 case 'ArrowLeft' :
921+ e . preventDefault ( ) ; // 禁用默认跳转列行为
917922 let prev_href = document . querySelector ( ".prev-chapter" ) . href ;
918923 if ( prev_href === location . href ) {
919924 showNotification ( "It's already the first chapter!" , 'warning' )
@@ -924,6 +929,7 @@ function initScript() {
924929 case ' ' :
925930 case 'ArrowDown' :
926931 case 'Space' :
932+ e . preventDefault ( ) ; // 禁用默认跳转列行为
927933 // 获取页面总高度
928934 const scrollHeight = document . documentElement . scrollHeight ;
929935 // 获取可视区域高度
@@ -935,6 +941,7 @@ function initScript() {
935941 break ;
936942 }
937943 case 'ArrowRight' :
944+ e . preventDefault ( ) ; // 禁用默认跳转列行为
938945 let next_href = document . querySelector ( ".next-chapter" ) . href ;
939946 if ( next_href == location . href ) {
940947 showNotification ( "It's already the last chapter!" , 'warning' )
0 commit comments