Membuat Tanda pada menu yg aktif di tampilan user web SIKOLAG ciDibuat
Login Terakhir
6 Tahun lalu,
Telah Dilihat 1554 Kali
| |
Sultan Account |
|
|
Ujang Rukman
Mengatakan :
Sultan Account
Assalamualaikum Warahmatullahi Wabarakatuh... Mas untuk membuat tanda pada menu yg sedang aktif di tampilan user SIKOLAG bagaimana? |
|
| Bukhori Muslim commented on 05 Mei 2018 08:49:02 Sultan Account |
|
|
|
Assalam,.. Tambahkan script berikut di dalam tag head pada file "application/views/phpmu-sekolah/template.php" :
<script>
$(function(){
var url = window.location.pathname,
urlRegExp = new RegExp(url.replace(/\/$/,'') + "$"); // create regexp to match current url pathname and remove trailing slash if present as it could collide with the link in navigation in case trailing slash wasn't present there
// now grab every link from the navigation
$('.the-menu a').each(function(){
// and test its normalized href against the url pathname regexp
if(urlRegExp.test(this.href.replace(/\/$/,''))){
$(this).addClass('active');
}
});
});
</script>
<style type="text/css">
.the-menu a.active{ color:red !important; }
</style>
simpan dan selesai, lalu coba akses lagi web dan klik menu2nya. :) |
|