หากไม่มีความกังวลใจเพิ่มเติมฉันจะโพสต์รหัสให้ทุกคน
<script> $ (function () {// ไฮไลต์ลิงก์ปัจจุบัน/แอคทีฟที่ใช้งานด้านซ้ายการนำทางเพื่อกำหนดการนำทางที่ใช้งานอยู่ $ ('ul.main-menu li a') แต่ละ (ฟังก์ชั่น () {var wo = window.location.href.substring (window.location.href.lastindexof ('/') ($ (นี่) .attr ('href') == (wo + ".html"))))) {$ (this) .parent (). addClass ('active'); $ (this) .parents (). addClass ('active'); $ (นี่) .parents ('li') ค้นหา ("i: แรก"). toggleclass ("glyphicon-minus"); $ (this) "syd" == wo) && ($ (นี่) .attr ('href') == "dbs.html" {$ (นี่) .parent (). addclass ('active'); $ (นี่) .parents (). addclass ('active'); $ (นี่). parents ('li') ค้นหา ("i: แรก"). toggleclass ("glyphicon-minus"); หน้าแรก*/$ (". หลักเมนู") คลิก (ฟังก์ชั่น () {// ตั้งค่า li ปัจจุบันเป็น active $ (this) .find ("i: แรก"). toggleclass ("glyphicon-minus");}); $ ("main-menu a") $ (นี่) .parent ('li') พี่น้อง ('. active ") ค้นหา (" i: first "). toggleclass (" glyphicon-minus "); // alert ($ (this) .index ()); // ลบรูปแบบการคลิกการนำทางอื่น ๆ Blings (". Active"). RemoveClass ("Active"). เด็ก ๆ ("UL") SlideUp ('Fast'); $ (นี่) .NEXT ('ul') Slidetoggle ('FAST'); $ (นี่). PARENT ('LI')ข้างต้นคือสคริปต์การนำทาง JavaScript ที่แนะนำโดยตัวแก้ไขเพื่อกำหนดการนำทางปัจจุบัน ฉันหวังว่ามันจะเป็นประโยชน์กับทุกคน หากคุณมีคำถามใด ๆ โปรดฝากข้อความถึงฉันและบรรณาธิการจะตอบกลับทุกคนในเวลา ขอบคุณมากสำหรับการสนับสนุนเว็บไซต์ Wulin.com!