2015. 4. 22. 08:20ㆍJAVASCRIPT
<style>
#nav { width:480px;margin:1em auto;}
#nav ul {margin:1em auto; padding:0; font:1em "Arial Black",sans-serif; }
#nav ul li{display:inline;}
#nav ul li a{text-decoration:none; margin:0; padding:.25em 25px; background:#666; color:#ffffff;}
#nav ul li a:hover{background:#ff9900; color:#ffffff;}
#nav ul li a.active {background:#ff9900; color:#ffffff;}
</style>
<script type="text/javascript">
$(function (){
$('#nav ul li a').each(function(){
var path = window.location.href;
var current = path.substring(path.lastIndexOf('/')+1);
var url = $(this).attr('href');
if(url == current){
$(this).addClass('active');
};
});
});
</script>
<div id="nav" >
<ul>
<li><a href='woosung02.asp'>One</a></li>
<li><a href='woosung03.asp'>Two</a></li>
<li><a href='woosung04.asp'>Three</a></li>
<li><a href='woosung05.asp'>Four</a></li>
</ul>
</div>
'JAVASCRIPT' 카테고리의 다른 글
이미지 흑백으로 변경하는 제이쿼리 (0) | 2015.05.21 |
---|---|
https://www.drupal.org/ (0) | 2015.03.26 |