JavaScript - - By Sam Deering

JQUERY OPTIONS SLIDER / BUTTON ANIMATION

jQuery code snippet to make an options bar slider which can be toggled up and down to show options for a tool or such. It changes the arrow image when the animation ends.

Online Demo

/*OPTIONS SLIDER / BUTTON ANIMATION -----------------*/
	var optionsToggleBtn = $('#options_btn');
	var buttonState = 1; //open
	optionsToggleBtn.live('click', function(){
		$('#options').slideToggle('slow' , function(){
			if (buttonState == 1) {
				buttonState = 0;
				$('#arrowoptionstoggle').attr('src','images/down-arrow.png');
			} else { 
				buttonState = 1;
				$('#arrowoptionstoggle').attr('src','images/up-arrow.png');
			}
		});
	});
Sponsors