jquery location?
jquery location?
Still struggling with this, got the link to and nav-indicator to know where to go to but as soon as the DOM is finished the location is lost
woodfellows.paston2.webfactional.com
At a guess I need to pass the triggered location back to the setIndicatorPosition function although I cant even see where the position is being reset or lost.
<script type="text/javascript">
17 $(document).ready(function() {
18 $('#nav').append('<img src="/media/images/base/nav-indicator.png" id="nav-indicator" alt=" indicator"/>');
19
20 $('#nav a').click(function(elem) {
21 $('html,body').clearQueue().stop();
22 if ($(this).parents('#nav').length > 0) {
23 setNavIndicatorPosition($(this));
24 }
25 elem.stopPropagation();
26 window.location.href=$(this).attr('href');
27 });
28 function setNavIndicatorPosition(object){
29 var fromLeft = $(object).context.offsetLeft + ($(object).context.offsetWidth / 2) - 11;
30 $('#nav-indicator').clearQueue().stop().animate({left: fromLeft}, 'slow');
31
32 }
33 loc = $(location).attr('href'); //this gives the complete url
34 alert(loc);
35 setNavIndicatorPosition(loc); // doesnt appear to do anything
36 });
37 </script>
Any help most appreciated