Created
October 19, 2011 16:33
-
-
Save adrianrodriguez/1298855 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$(".grid_3").each(function(){ | |
// .next finds the next Dom element in this case it would be another grid_3 element | |
var next = $(this).next(); | |
var prev = $(this).prev(); | |
// Store this current element into a var called "that" so that "this" can be used in it's own handler | |
var that = this; | |
// Find the .next element in this specific element and call a click function | |
$(this).find('.next').click(function() { | |
// Hide the current parent element the variable set above for the grid_3 element | |
$(that).hide(); | |
// Fade in the next element in the dom | |
next.fadeIn(); | |
}); | |
// Reverse that sucka | |
$(this).find('.prev').click(function() { | |
$(that).hide(); | |
prev.fadeIn(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment