Skip to content

Instantly share code, notes, and snippets.

@Miri92
Last active December 24, 2015 23:09
Show Gist options
  • Save Miri92/6877942 to your computer and use it in GitHub Desktop.
Save Miri92/6877942 to your computer and use it in GitHub Desktop.
DLE-də menu üzərinə active class əlavə etmək
<!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