304304 }
305305
306306 .markdown-close {
307- position : absolute ;
308- top : 15 px ;
309- right : 20px ;
307+ position : fixed ;
308+ top : 65 px ;
309+ right : calc (( 100 % - 900 px ) / 2 + 20px ) ;
310310 font-size : 30px ;
311311 cursor : pointer;
312312 color : # 666 ;
313313 transition : color 0.3s ;
314+ background : white;
315+ border-radius : 50% ;
316+ width : 40px ;
317+ height : 40px ;
318+ display : flex;
319+ align-items : center;
320+ justify-content : center;
321+ box-shadow : 0 2px 10px rgba (0 , 0 , 0 , 0.2 );
322+ z-index : 1001 ;
323+ }
324+
325+ @media (max-width : 900px ) {
326+ .markdown-close {
327+ right : 20px ;
328+ }
314329 }
315330
316331 .markdown-close : hover {
@@ -499,7 +514,7 @@ <h2>📚 8 個學習場景</h2>
499514 < div class ="scenario-description "> 建立 Copilot 使用基礎,體驗傳統 Chat 功能</ div >
500515 < span class ="agent-indicator agent-0 "> Agent 0%</ span >
501516 < div class ="scenario-links ">
502- < a href ="# " onclick ="loadMarkdown('./01-first-experience/README .md', '場景 1:初次對話體驗'); return false; " class ="btn btn-doc "> 📚 查看教學</ a >
517+ < a href ="# " onclick ="loadMarkdown('./01-first-experience/LESSON_GUIDE .md', '場景 1:初次對話體驗'); return false; " class ="btn btn-doc "> 📚 查看教學</ a >
503518 < a href ="./01-first-experience/ " class ="btn btn-demo "> 🎯 實際應用</ a >
504519 </ div >
505520 </ div >
@@ -510,7 +525,7 @@ <h2>📚 8 個學習場景</h2>
510525 < div class ="scenario-description "> 掌握 @workspace 核心功能,理解專案結構</ div >
511526 < span class ="agent-indicator agent-0 "> Agent 0%</ span >
512527 < div class ="scenario-links ">
513- < a href ="# " onclick ="loadMarkdown('./02-code-explanation/README .md', '場景 2:程式碼解釋實作'); return false; " class ="btn btn-doc "> 📚 查看教學</ a >
528+ < a href ="# " onclick ="loadMarkdown('./02-code-explanation/LESSON_GUIDE .md', '場景 2:程式碼解釋實作'); return false; " class ="btn btn-doc "> 📚 查看教學</ a >
514529 < a href ="./02-code-explanation/ " class ="btn btn-demo "> 🎯 實際應用</ a >
515530 </ div >
516531 </ div >
@@ -521,7 +536,7 @@ <h2>📚 8 個學習場景</h2>
521536 < div class ="scenario-description "> 體驗 Agent 協助編程,對比手動 vs AI 效率</ div >
522537 < span class ="agent-indicator agent-20 "> Agent 20%</ span >
523538 < div class ="scenario-links ">
524- < a href ="# " onclick ="loadMarkdown('./03-function-generation/README .md', '場景 3:函數生成'); return false; " class ="btn btn-doc "> 📚 查看教學</ a >
539+ < a href ="# " onclick ="loadMarkdown('./03-function-generation/LESSON_GUIDE .md', '場景 3:函數生成'); return false; " class ="btn btn-doc "> 📚 查看教學</ a >
525540 < a href ="./03-function-generation/ " class ="btn btn-demo "> 🎯 實際應用</ a >
526541 </ div >
527542 </ div >
@@ -532,7 +547,7 @@ <h2>📚 8 個學習場景</h2>
532547 < div class ="scenario-description "> 讓 Agent 主動發現和修復程式問題</ div >
533548 < span class ="agent-indicator agent-30 "> Agent 30%</ span >
534549 < div class ="scenario-links ">
535- < a href ="# " onclick ="loadMarkdown('./04-debugging-assistant/README .md', '場景 4:偵錯輔助'); return false; " class ="btn btn-doc "> 📚 查看教學</ a >
550+ < a href ="# " onclick ="loadMarkdown('./04-debugging-assistant/LESSON_GUIDE .md', '場景 4:偵錯輔助'); return false; " class ="btn btn-doc "> 📚 查看教學</ a >
536551 < a href ="./04-debugging-assistant/ " class ="btn btn-demo "> 🎯 實際應用</ a >
537552 </ div >
538553 </ div >
@@ -543,7 +558,7 @@ <h2>📚 8 個學習場景</h2>
543558 < div class ="scenario-description "> Agent 自主設計測試架構和完整用例</ div >
544559 < span class ="agent-indicator agent-50 "> Agent 50%</ span >
545560 < div class ="scenario-links ">
546- < a href ="# " onclick ="loadMarkdown('./05-unit-testing/README .md', '場景 5:單元測試'); return false; " class ="btn btn-doc "> 📚 查看教學</ a >
561+ < a href ="# " onclick ="loadMarkdown('./05-unit-testing/LESSON_GUIDE .md', '場景 5:單元測試'); return false; " class ="btn btn-doc "> 📚 查看教學</ a >
547562 < a href ="./05-unit-testing/ " class ="btn btn-demo "> 🎯 實際應用</ a >
548563 </ div >
549564 </ div >
@@ -554,7 +569,7 @@ <h2>📚 8 個學習場景</h2>
554569 < div class ="scenario-description "> Agent 分析遺留代碼並執行重構策略</ div >
555570 < span class ="agent-indicator agent-60 "> Agent 60%</ span >
556571 < div class ="scenario-links ">
557- < a href ="# " onclick ="loadMarkdown('./06-code-refactoring/README .md', '場景 6:程式碼重構'); return false; " class ="btn btn-doc "> 📚 查看教學</ a >
572+ < a href ="# " onclick ="loadMarkdown('./06-code-refactoring/LESSON_GUIDE .md', '場景 6:程式碼重構'); return false; " class ="btn btn-doc "> 📚 查看教學</ a >
558573 < a href ="./06-code-refactoring/ " class ="btn btn-demo "> 🎯 實際應用</ a >
559574 </ div >
560575 </ div >
@@ -565,7 +580,7 @@ <h2>📚 8 個學習場景</h2>
565580 < div class ="scenario-description "> Agent 自動分析程式碼生成完整文件體系</ div >
566581 < span class ="agent-indicator agent-80 "> Agent 80%</ span >
567582 < div class ="scenario-links ">
568- < a href ="# " onclick ="loadMarkdown('./07-documentation/README .md', '場景 7:文件生成'); return false; " class ="btn btn-doc "> 📚 查看教學</ a >
583+ < a href ="# " onclick ="loadMarkdown('./07-documentation/LESSON_GUIDE .md', '場景 7:文件生成'); return false; " class ="btn btn-doc "> 📚 查看教學</ a >
569584 </ div >
570585 </ div >
571586
@@ -586,7 +601,7 @@ <h2>📚 8 個學習場景</h2>
586601 </ div >
587602 </ div >
588603 < div class ="scenario-links scenario-links-3 ">
589- < a href ="# " onclick ="loadMarkdown('./08-comprehensive-project/TEACHING_GUIDE .md', '場景 8:GitHub 自動化 Agent'); return false; " class ="btn btn-doc "> 📚 教學</ a >
604+ < a href ="# " onclick ="loadMarkdown('./08-comprehensive-project/LESSON_GUIDE .md', '場景 8:GitHub 自動化 Agent'); return false; " class ="btn btn-doc "> 📚 教學</ a >
590605 < a href ="https://github.com/yulin0629/copilot-agent-demo-todo " target ="_blank " class ="btn btn-repo "> 💻 GitHub</ a >
591606 < a href ="https://yulin0629.github.io/copilot-agent-demo-todo/ " target ="_blank " class ="btn btn-demo "> 🎯 Demo</ a >
592607 </ div >
@@ -611,10 +626,26 @@ <h2>📚 8 個學習場景</h2>
611626 </ div >
612627
613628 < script >
629+ // 儲存和取得捲動位置
630+ function saveScrollPosition ( path , position ) {
631+ localStorage . setItem ( `scroll_${ path } ` , position ) ;
632+ }
633+
634+ function getScrollPosition ( path ) {
635+ return parseInt ( localStorage . getItem ( `scroll_${ path } ` ) || '0' ) ;
636+ }
637+
638+ // 儲存當前文件路徑
639+ let currentMarkdownPath = '' ;
640+
614641 // 載入並顯示 Markdown
615642 async function loadMarkdown ( path , title ) {
616643 const modal = document . getElementById ( 'markdownModal' ) ;
617644 const body = document . getElementById ( 'markdownBody' ) ;
645+ const container = body . parentElement ;
646+
647+ // 儲存當前路徑
648+ currentMarkdownPath = path ;
618649
619650 // 顯示 Modal
620651 modal . style . display = 'block' ;
@@ -641,8 +672,24 @@ <h2>📚 8 個學習場景</h2>
641672 // 為所有程式碼區塊添加複製按鈕
642673 addCopyButtons ( ) ;
643674
644- // 滾動到頂部
645- body . parentElement . scrollTop = 0 ;
675+ // 恢復上次的捲動位置
676+ const savedPosition = getScrollPosition ( path ) ;
677+ if ( savedPosition > 0 ) {
678+ // 使用 setTimeout 確保內容已經渲染
679+ setTimeout ( ( ) => {
680+ container . scrollTop = savedPosition ;
681+ } , 100 ) ;
682+ } else {
683+ // 如果沒有儲存的位置,滾動到頂部
684+ container . scrollTop = 0 ;
685+ }
686+
687+ // 監聽捲動事件,儲存位置
688+ container . onscroll = debounce ( ( ) => {
689+ if ( currentMarkdownPath ) {
690+ saveScrollPosition ( currentMarkdownPath , container . scrollTop ) ;
691+ }
692+ } , 300 ) ;
646693
647694 } catch ( error ) {
648695 body . innerHTML = `
@@ -655,9 +702,34 @@ <h2>❌ 載入失敗</h2>
655702 }
656703 }
657704
705+ // 防抖函數
706+ function debounce ( func , wait ) {
707+ let timeout ;
708+ return function executedFunction ( ...args ) {
709+ const later = ( ) => {
710+ clearTimeout ( timeout ) ;
711+ func ( ...args ) ;
712+ } ;
713+ clearTimeout ( timeout ) ;
714+ timeout = setTimeout ( later , wait ) ;
715+ } ;
716+ }
717+
658718 // 關閉 Markdown Modal
659719 function closeMarkdown ( ) {
660- document . getElementById ( 'markdownModal' ) . style . display = 'none' ;
720+ const modal = document . getElementById ( 'markdownModal' ) ;
721+ const container = document . getElementById ( 'markdownBody' ) . parentElement ;
722+
723+ // 儲存最後的捲動位置
724+ if ( currentMarkdownPath ) {
725+ saveScrollPosition ( currentMarkdownPath , container . scrollTop ) ;
726+ }
727+
728+ // 清理事件監聽器
729+ container . onscroll = null ;
730+
731+ // 關閉 Modal
732+ modal . style . display = 'none' ;
661733 }
662734
663735 // 點擊 Modal 外部關閉
0 commit comments