Snippets

Here's some of my tips, tweaks and tuts, ranging from PHP, Linux, MySQL and more!

Snippets / jQuery

Go to top of page with jQuery

http://www.nomadjourney.com/2009/09/go-to-top-of-page-using-jquery/

13 years ago / Read More

Snippets / jQuery

jQuery animation queue problem

  • Snippet Length: 2 minutes
  • Difficulty: Easy
  • Technologies: JavaScript, jQuery, HTML

When I first starting playing around with jQuery I found myself encountering animated elements that were still moving/bouncing around long after they should have been.

After investigating this I found that one way to counter act this would be use the jQuery function stop() before calling animate()

This example demonstrates it;

$(document).ready(function() {
    // effect is applied when hover takes place
    $("#nav a").hover( function() {
		$(this).stop().animate({ "height" : "40px" })	
	},
		function() {
			$(this).stop().animate({  "line-height" : "40px" })	
		}
	);
});

14 years ago / Read More