Last active
December 24, 2015 23:09
-
-
Save Miri92/6877942 to your computer and use it in GitHub Desktop.
DLE-də menu üzərinə active class əlavə etmək
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>DLE-də menu üzərinə active class əlavə etmək</title> | |
<script type="text/javascript"> | |
$(function () { | |
$('.navigation a').each(function () { | |
var location = window.location.href | |
var link = this.href | |
var result = location.match(link); | |
if(result != null) { | |
$(this).addClass('active'); | |
} | |
}); | |
}); | |
</script> | |
<style> | |
.active {background-color: green; color:#fff; } | |
</style> | |
</head> | |
<body> | |
<ul class="navigation"> | |
<li><a href="/bolme-link/">bolme adi</a></li> | |
<li><a href="/bolme-link/">bolme adi</a></li> | |
<li><a href="/bolme-link/">bolme adi</a></li> | |
<li><a href="/bolme-link/">bolme adi</a></li> | |
<li><a href="/bolme-link/">bolme adi</a></li> | |
</ul> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment