So the problem is when I first go on my site those 3 links are blue and after clicking any of them they turn orange and the last clicked one stays darker/reddish for navigation purposes. I want it to be that orange color by default when you go on the page not only after clicking any of the links.
<ul class="nav" >
<li><a href="champions.php">Champions</a></li>
<li><a href="items.php">Items</a></li>
<li><a href="changes.php">Changes</a></li>
</ul>
css part:
.nav {
float: right;
margin: 0;
padding: 0;
list-style: none;
}
.nav li:hover{
background: #cccccc;
}
.nav li{
background: a0a0a0;
padding: 2px;
display:inline-block;
margin-right: 5px;
position: relative;
box-shadow:
1px 1px #cccccc,
2px 2px #cccccc,
3px 3px #cccccc;
transition: all 0.1s ease-in;
}
.nav li:active{
box-shadow: none;
top: 3px;
left: 3px;
}
.nav li a{
text-decoration: none;
}
.nav li a:hover{ color:orange; }
and jquery
$(document).ready(function() {
var hash = window.location.hash.substr(1);
var href = $('.nav li a').each(function(){
var href = $(this).attr('href');
if(hash==href.substr(0,href.length-4)){
var toLoad = hash+'.php #content';
$('#content').load(toLoad)
}
});
$('.nav li a').click(function(){
var toLoad = $(this).attr('href')+' #content';
$('#content').hide('fast',loadContent);
$('#load').remove();
$('#load').fadeIn('normal');
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-4);
function loadContent() {
$('#content').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#content').show('normal',hideLoader());
}
function hideLoader() {
$('#load').fadeOut('normal');
}
$('.nav li a').addClass("undnone");
$(this).removeClass("undnone").addClass("und");
return false;
});
});
A little more css (from jquery)
.und
{
color: red;
text-decoration: none;`
`}
.undnone{
color: #fc7425;
text-decoration: none;
}