Created
November 10, 2010 21:13
-
-
Save joshuaogle/671527 to your computer and use it in GitHub Desktop.
Code used in JoshuaOgle.com and in an upcoming article on ID based reusable jquery for simple effects
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
| /* Reusable Effects */ | |
| $('[id*=toggle-]').live('click',function() { | |
| var container = $(this).attr("id").replace("toggle-",""); | |
| $('#'+container).toggle(); | |
| return false; | |
| }); | |
| $('[id*=slide-]').live('click',function() { | |
| var container = $(this).attr("id").replace("slide-",""); | |
| $('#'+container).slideToggle(); | |
| return false; | |
| }); | |
| $('[id*=fade-]').live('click',function() { | |
| var container = $(this).attr("id").replace("fade-",""); | |
| if ($('#'+container) .is(':hidden')) { | |
| $('#'+container).fadeIn(); | |
| } else if ($('#'+container) .is(':visible')){ | |
| $('#'+container).fadeOut(); | |
| } | |
| return false; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment