こんにちは、鴨田です。 今更感はすごくあるとは思いますが、 コーダー初心者でも簡単なJavaScript/jQueryのコードで、 ちょっとした運用を楽に出来るTipsを紹介したいと思います。 1.現在見ているページのナビゲーションをアクティブにする JS if (document.URL.indexOf("001.html") != -1) { $("nav a.top").toggleClass("on"); } else if (document.URL.indexOf("002.html") != -1){ $("nav a.list").toggleClass("on"); }
![初心者のコーダーでも簡単に実装出来るJavaScript/jQuery Tips](https://cdn-ak-scissors.b.st-hatena.com/image/square/39e482c008d605a5b5f9180e98756d084baf2b67/height=288;version=1;width=512/https%3A%2F%2Fblog.asial.co.jp%2Fogp-logo.jpg)