View Single Post
  #18 (permalink)  
Old 28-07-2008, 01:45 AM
tommylogic's Avatar
tommylogic tommylogic is offline
f*ck yeah it validates!!!
 
Join Date: Apr 2007
Location: Virtually Everywhere
Gender: Male
Posts: 6,314
Default

Quote:
Originally Posted by paparazi View Post
Your website looks really good. What did you use to make the arrow move?
HTML Code:
<!-- Nav Arrow -->
<script type="text/javascript">

var navArrowSlider = function(navWrap, navElementsArray, activeID, arrowY) {
	var youAreHere = new Fx.Tween($(navWrap), { 
		duration: 1200,
		transition: Fx.Transitions.Elastic.easeOut  
	});

	$$(navElementsArray).each(function(item){  
		item.addEvent('mouseenter', function() { 
			var thisPos = item.getPosition(navWrap).x  + item.getSize().x - 50; 
			youAreHere.cancel();
			youAreHere.start('background-position', thisPos + 'px ' + arrowY + 'px'); 
		});
	});
	
	var currentArrow = function() {
		youAreHere.cancel();
		var activePos = $(activeID).getPosition(navWrap).x  + $(activeID).getSize().x - 50; 
		youAreHere.start('background-position', activePos + 'px ' + arrowY + 'px');      
	};
	
	//correct IE rendering problem (without this, it wont go to the active nav onload)
	var activePos = $(activeID).getPosition(navWrap).x  + $(activeID).getSize().x - 50;  
	$(navWrap).setStyle('background-position', activePos + 'px ' + arrowY + 'px');       
	
	//works to set image to starting position in other browsers
	currentArrow(); 
	
	$(navWrap).addEvent('mouseleave', currentArrow);	
}; 
	
window.addEvent('domready', function() {
	navArrowSlider(
		'nav_wrap', // ID of nav wrap
		'#nav ul li', // Array selector of nav elements 
		'active_nav', // ID of current nav element
		'50px' //  Background position y of background image
	); 	
}); 
</script>
<!--/Nav Arrow -->
Reply With Quote