Forum Moderators: not2easy
<script type="text/javascript" charset="utf-8">
//<![CDATA[
jQuery(function() {
jQuery('.current a:active').each(function() {
var href = jQuery(this).find('a').attr('href');
if (href === window.location.pathname) {
jQuery(this).addClass('current');
}
});
});
//]]>
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Click Test</title>
<style type="text/css">
#container { display: block; margin: 4em auto; width: 34em; text-align: center; }
#container li, #container li a { display: block; }
#container li { float: left; width: 6.25em; margin: 0 1em; padding: 0; background: #f5f5f5; }
#container li a { float: left; width: 6em; padding: 4em 0; }
.active-class { border: 6px solid #0000a0; }
</style>
<script type="text/javascript" src="jquery-1.4.3.min.js"></script>
<script type="text/javascript">
$(function() {
$('#container a').click(function() { return swapBorder(this); });
});
//
function swapBorder(clickObject) {
var currentId=clickObject.id;
$('#container a').each(function() {
if ($(this).attr('id')==currentId) {
$(this).addClass('active-class');
}
else { $(this).removeClass('active-class'); }
});
return false;
}
</script>
</head>
<body>
<ul id="container">
<li><a href="#" id="home">Home</a></li>
<li><a href="#" id="widgets">Widgets</a></li>
<li><a href="#" id="about">About</a></li>
<li><a href="#" id="contact">Contact</a></li>
</ul>
</body>
</html>
style a current selected image on the slider