This is going to be difficult for me to explain, so I’ll do my best. Heres this code:
$('#navibar a').hover(function(){
var position = $(this).position();
var width = $(this).width();
$('#underliner').css({'width': '' + width + '','left': position.left});
//$('#underliner').show("slide", { direction: "left" }, 100);
$('#underliner').stop().animate({opacity: 1}, 30).show();
}, function () {
var homePos = $(this).find(attr(activePageHref)).position();
var homeWidth = $(this).find(attr(activePageHref)).width();
//$('#underliner').css({'width': '' + homeWidth + '','left': homePos.left});
//$('#underliner').show("slide", { direction: "left" }, 100);
//$('#underliner').stop().animate({opacity: 1}, 30).show();
alert(activePageHref);
});
activePageHref is set outside this as the page that has been clicked on. On the alert, it is showing correctly (for examples, lets just say its value is “home”. I need to somehow set the #underliner.css position and width to the page link in the navigation that is selected on hover out, so is there a way to “find” other ‘a’s and use them? Hopefully in the code it’s obvious what I was trying to do. This is my markup:
<ul id="navibar">
<li><a href="home">Home</a></li>
<li><a href="products">Products</a></li>
<li><a href="games">Games</a></li>
<li><a href="store">Store</a></li>
<li><a href="support">Support</a></li>
<li><a href="community">Community</a></li>
</ul>
Also, I know the first block of code is BIG TIME wrong, that was just the last thing I did out of aggrevation and desperation before I decided to post on here.
Use the attribute selector to find the link with the href as activePageHref